diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-03-14 23:13:57 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-03-14 23:13:57 +0100 |
commit | 1f73f0f163eeb8a889e3799c0c63bcb437e531ac (patch) | |
tree | 911be730b1044f450394285b6a726db9c16f2aa6 /src/user-sessions.c | |
parent | 04d391dabcd860e2d0542ece1d1c7e0a9d9cd0ac (diff) |
pam: determine user cgroup tree from cgroup of PID 1
Diffstat (limited to 'src/user-sessions.c')
-rw-r--r-- | src/user-sessions.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/user-sessions.c b/src/user-sessions.c index 8026961560..d3faad0cd6 100644 --- a/src/user-sessions.c +++ b/src/user-sessions.c @@ -57,14 +57,25 @@ int main(int argc, char*argv[]) { } else if (streq(argv[1], "stop")) { int r, q; + char *cgroup_user_tree = NULL; if ((r = write_one_line_file("/var/run/nologin", "System is going down.")) < 0) log_error("Failed to create /var/run/nologin: %s", strerror(-r)); - if ((q = cg_kill_recursive_and_wait(SYSTEMD_CGROUP_CONTROLLER, "/user", true)) < 0) + if ((q = cg_get_user_path(&cgroup_user_tree)) < 0) { + log_error("Failed to determine use path: %s", strerror(-q)); + goto finish; + } + + q = cg_kill_recursive_and_wait(SYSTEMD_CGROUP_CONTROLLER, cgroup_user_tree, true); + free(cgroup_user_tree); + + if (q < 0) { log_error("Failed to kill sessions: %s", strerror(-q)); + goto finish; + } - if (r < 0 || q < 0) + if (r < 0) goto finish; } else { |