]> 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 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 49c65117d247e9697b19d6847df5678f6c27ea0f)

src/tools/cgexec.c

index 863d4fb58d48ebab1b5cd92d44f774aaa82a4ad2..ead27bb00755859716665a3ebb10d2df3e34ad78 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();