]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: do not setup/teardown cgroup if MANAGER_TEST_RUN_MINIMAL is set as a flag
authorLuca Boccassi <bluca@debian.org>
Wed, 30 Jun 2021 23:04:58 +0000 (00:04 +0100)
committerLuca Boccassi <bluca@debian.org>
Wed, 30 Jun 2021 23:06:35 +0000 (00:06 +0100)
Rather than checking if test_run_flags is set exclusively to MANAGER_TEST_RUN_MINIMAL,
check if it is set as a flag, so that it can be used together with other flags.

src/core/cgroup.c
src/core/manager.c

index 3f8e06240fa388cf40ed65c487dceadd63572654..8f39c9436bf1e25ab1598af11168166048d5d5da 100644 (file)
@@ -3303,7 +3303,7 @@ void manager_shutdown_cgroup(Manager *m, bool delete) {
 
         /* We can't really delete the group, since we are in it. But
          * let's trim it. */
-        if (delete && m->cgroup_root && m->test_run_flags != MANAGER_TEST_RUN_MINIMAL)
+        if (delete && m->cgroup_root && !FLAGS_SET(m->test_run_flags, MANAGER_TEST_RUN_MINIMAL))
                 (void) cg_trim(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, false);
 
         m->cgroup_empty_event_source = sd_event_source_unref(m->cgroup_empty_event_source);
index f3275a4070e58425024ce03e2951cf26d9522685..c239737e4006b0c8458e10a3bc7557b16439d3e4 100644 (file)
@@ -870,7 +870,7 @@ int manager_new(UnitFileScope scope, ManagerTestRunFlags test_run_flags, Manager
         if (r < 0)
                 return r;
 
-        if (test_run_flags == MANAGER_TEST_RUN_MINIMAL) {
+        if (FLAGS_SET(test_run_flags, MANAGER_TEST_RUN_MINIMAL)) {
                 m->cgroup_root = strdup("");
                 if (!m->cgroup_root)
                         return -ENOMEM;