]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgxset: guard systemd default delegate slice
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Thu, 23 Nov 2023 08:48:50 +0000 (14:18 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Thu, 7 Dec 2023 15:58:13 +0000 (08:58 -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>
src/tools/cgxset.c

index 83e32232af0c747d785c30addd8587fbc98f9849..f22482c0f2f15367df0b6dd8527b687cfb024f0c 100644 (file)
@@ -146,7 +146,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;
@@ -255,9 +257,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) {