]> 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 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/cgset.c

index 51c4d1447a2c513a4ba14727b0abd1e8189ae489..8b1ecf3b569d70badbe10f4034673b7141f25cbb 100644 (file)
@@ -444,7 +444,9 @@ static int add_subtree_control_name_value(struct control_value *name_value)
 
 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 recursive = 0;
@@ -564,9 +566,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) {