From: Mike Yuan Date: Mon, 19 May 2025 16:41:29 +0000 (+0200) Subject: core/cgroup: also assume cgroup.events frozen attr is available X-Git-Tag: v258-rc1~572^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=88f4bf8a8bfb4d21fa160bb69f80c53c1698becc;p=thirdparty%2Fsystemd.git core/cgroup: also assume cgroup.events frozen attr is available Follow-up for 3c86a935ad2f88a83f1f465544cb0c8bdc288f4c --- diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 2050494a859..504a64d231f 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -3176,7 +3176,7 @@ static int unit_check_cgroup_events(Unit *u) { if (!crt || !crt->cgroup_path) return 0; - r = cg_get_keyed_attribute_graceful( + r = cg_get_keyed_attribute( SYSTEMD_CGROUP_CONTROLLER, crt->cgroup_path, "cgroup.events", @@ -3188,22 +3188,18 @@ static int unit_check_cgroup_events(Unit *u) { /* The cgroup.events notifications can be merged together so act as we saw the given state for the * first time. The functions we call to handle given state are idempotent, which makes them * effectively remember the previous state. */ - if (values[0]) { - if (streq(values[0], "1")) - unit_remove_from_cgroup_empty_queue(u); - else - unit_add_to_cgroup_empty_queue(u); - } + if (streq(values[0], "1")) + unit_remove_from_cgroup_empty_queue(u); + else + unit_add_to_cgroup_empty_queue(u); /* Disregard freezer state changes due to operations not initiated by us. * See: https://github.com/systemd/systemd/pull/13512/files#r416469963 and * https://github.com/systemd/systemd/pull/13512#issuecomment-573007207 */ - if (values[1] && IN_SET(u->freezer_state, FREEZER_FREEZING, FREEZER_FREEZING_BY_PARENT, FREEZER_THAWING)) + if (IN_SET(u->freezer_state, FREEZER_FREEZING, FREEZER_FREEZING_BY_PARENT, FREEZER_THAWING)) unit_freezer_complete(u, streq(values[1], "0") ? FREEZER_RUNNING : FREEZER_FROZEN); - free(values[0]); - free(values[1]); - + free_many_charp(values, ELEMENTSOF(values)); return 0; }