diff options
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 { |