From f12f53692ef8870ec25bb5deaab540df86db85fa Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Fri, 9 Apr 2021 18:58:11 +0200 Subject: [PATCH] cgroup: allow adding self (PID 0) to a leaf group Signed-off-by: Joachim Wiberg --- src/cgroup.c | 2 +- src/getty.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cgroup.c b/src/cgroup.c index 5140f023..a64ae574 100644 --- a/src/cgroup.c +++ b/src/cgroup.c @@ -139,7 +139,7 @@ static int cgroup_leaf_init(char *group, char *name, int pid, const char *cfg) char path[256]; _d("group %s, name %s, pid %d, cfg %s", group, name, pid, cfg ?: "NIL"); - if (pid <= 1) { + if (pid < 0 || pid == 1) { errno = EINVAL; return 1; } diff --git a/src/getty.c b/src/getty.c index ba0e9f4a..3180da3f 100644 --- a/src/getty.c +++ b/src/getty.c @@ -185,7 +185,7 @@ static int do_login(char *name) { struct stat st; - cgroup_user(name, getpid()); + cgroup_user(name, 0); execl(_PATH_LOGIN, _PATH_LOGIN, name, NULL); /*