if (r == 0)
return 1; /* Will call us back */
- r = session_kill(s, whom, signo);
+ r = session_kill(s, whom, signo, error);
if (r < 0)
return r;
return SESSION_ONLINE;
}
-int session_kill(Session *s, KillWhom whom, int signo) {
+int session_kill(Session *s, KillWhom whom, int signo, sd_bus_error *error) {
assert(s);
switch (whom) {
case KILL_ALL:
+ if (!SESSION_CLASS_WANTS_SCOPE(s->class))
+ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
+ "Session '%s' has no associated scope", s->id);
+
if (!s->scope)
- return -ESRCH;
+ return sd_bus_error_set_errnof(error, ESRCH, "Scope for session '%s' not active", s->id);
- return manager_kill_unit(s->manager, s->scope, KILL_ALL, signo, NULL);
+ return manager_kill_unit(s->manager, s->scope, KILL_ALL, signo, error);
case KILL_LEADER:
return pidref_kill(&s->leader, signo);
int session_release(Session *s);
int session_save(Session *s);
int session_load(Session *s);
-int session_kill(Session *s, KillWhom whom, int signo);
+int session_kill(Session *s, KillWhom whom, int signo, sd_bus_error *error);
SessionState session_get_state(Session *u);