]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgset: guard systemd default delegate slice
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Tue, 21 Nov 2023 08:46:47 +0000 (14:16 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 7 Dec 2023 16:21:09 +0000 (09:21 -0700)
Guard setting default systemd delegate slice with WITH_SYSTEMD, to limit
the systemd delegation only to --enable-systemd=yes only.

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit 29dfcfb6768c5168b754bfe0471a820333802fe4)

src/tools/cgset.c

index 82f698f8360909b0bd7a7e8afc888e8bb8e9a3f8..292955447bd1d158a2bc04cc12732740e5cf3ad6 100644 (file)
@@ -132,7 +132,9 @@ err:
 #ifndef UNIT_TEST
 int main(int argc, char *argv[])
 {
+#ifdef WITH_SYSTEMD
        int ignore_default_systemd_delegate_slice = 0;
+#endif
        struct control_value *name_value = NULL;
        int nv_number = 0;
        int nv_max = 0;
@@ -229,9 +231,10 @@ int main(int argc, char *argv[])
                goto err;
        }
 
-       /* this is false always for disable-systemd */
+#ifdef WITH_SYSTEMD
        if (!ignore_default_systemd_delegate_slice)
                cgroup_set_default_systemd_cgroup();
+#endif
 
        /* copy the name-value pairs from -r options */
        if ((flags & FL_RULES) != 0) {