]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tools/cgexec: guard systemd default delegate slice
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Sun, 19 Nov 2023 08:44:57 +0000 (14:14 +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/cgexec.c

index ba8b8b95b9609530edcdad6551b2ab7992e23810..10b88c20dba3483c1fc7c0e9f92fc1c0662d077d 100644 (file)
@@ -70,7 +70,9 @@ static void usage(int status, const char *program_name)
 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
        pid_t scope_pid = -1;
        int child_status = 0;
        int replace_idle = 0;
@@ -129,9 +131,10 @@ int main(int argc, char *argv[])
                return ret;
        }
 
-       /* this is false always for disable-systemd */
+#ifdef WITH_SYSTEMD
        if (!ignore_default_systemd_delegate_slice)
                cgroup_set_default_systemd_cgroup();
+#endif
 
        /* Just for debugging purposes. */
        uid = geteuid();