]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/lscgroup: guard systemd default delegate slice
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Fri, 24 Nov 2023 08:49:51 +0000 (14:19 +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 2dde191094f63e74119c3d285eed236737dfe1a8)

src/tools/lscgroup.c

index 280f1d6818d390200f5c78029a1afbd7bd69aad7..8546ef295c731c749999ba58949ee4a79963f377 100644 (file)
@@ -246,7 +246,9 @@ int main(int argc, char *argv[])
        };
 
        struct cgroup_group_spec *cgroup_list[CG_HIER_MAX];
+#ifdef WITH_SYSTEMD
        int ignore_default_systemd_delegate_slice = 0;
+#endif
        int flags = 0;
        int ret = 0;
        int c;
@@ -291,9 +293,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
 
        /* read the list of controllers */
        while (optind < argc) {