]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgdelete: guard systemd default delegate slice
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Sat, 18 Nov 2023 08:43:46 +0000 (14:13 +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/cgdelete.c

index 5e85a9316c669634ba822307727ac063232bcdcc..cf135d8cc739481819b836539f673d3f0d78566d 100644 (file)
@@ -113,7 +113,9 @@ static int skip_add_controller(int counter, int *skip, struct ext_cgroup_record
 
 int main(int argc, char *argv[])
 {
+#ifdef WITH_SYSTEMD
        int ignore_default_systemd_delegate_slice = 0;
+#endif
        struct cgroup_group_spec **cgroup_list = NULL;
        struct ext_cgroup_record *ecg_list = NULL;
        struct cgroup_controller *cgc;
@@ -186,9 +188,10 @@ int main(int argc, char *argv[])
                }
        }
 
-       /* this is false always for disable-systemd */
+#ifdef WITH_SYSTEMD
        if (!ignore_default_systemd_delegate_slice)
                cgroup_set_default_systemd_cgroup();
+#endif
 
        /* parse groups on command line */
        for (i = optind; i < argc; i++) {