mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
login: fix session_kill(..., KILL_LEADER,...) (#35105)
`loginctl kill-session --kill-whom=leader <N>` (or the D-Bus equivalent) doesn't work because logind ends up calling `KillUnit(..., "main", ...)` on a scope unit and these don't have a `MainPID` property. Here, I just make it send a signal to the `Leader` directly.
This commit is contained in:
parent
053452e22b
commit
8254755091
@ -1390,10 +1390,20 @@ SessionState session_get_state(Session *s) {
|
||||
int session_kill(Session *s, KillWhom whom, int signo) {
|
||||
assert(s);
|
||||
|
||||
if (!s->scope)
|
||||
return -ESRCH;
|
||||
switch (whom) {
|
||||
|
||||
return manager_kill_unit(s->manager, s->scope, whom, signo, NULL);
|
||||
case KILL_ALL:
|
||||
if (!s->scope)
|
||||
return -ESRCH;
|
||||
|
||||
return manager_kill_unit(s->manager, s->scope, KILL_ALL, signo, NULL);
|
||||
|
||||
case KILL_LEADER:
|
||||
return pidref_kill(&s->leader, signo);
|
||||
|
||||
default:
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
static int session_open_vt(Session *s, bool reopen) {
|
||||
|
Loading…
Reference in New Issue
Block a user