X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fmachine%2Fmachine.c;h=9a5cc9a63c4eb1f017d0c8a2196c14ec6ce9c833;hb=e0e5ce237b11f2d97189cd7725bf339b4b8a78de;hp=e45c443495c0650f5372d927a2c2f29b44298f47;hpb=89f7c8465cd1ab37347dd0c15920bce31e8225df;p=elogind.git diff --git a/src/machine/machine.c b/src/machine/machine.c index e45c44349..9a5cc9a63 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -252,7 +252,7 @@ static int machine_start_scope(Machine *m, sd_bus_message *properties, sd_bus_er if (!m->unit) { _cleanup_free_ char *escaped = NULL; - char *scope, *description, *job; + char *scope, *description, *job = NULL; escaped = unit_name_escape(m->name); if (!escaped) @@ -322,7 +322,7 @@ int machine_start(Machine *m, sd_bus_message *properties, sd_bus_error *error) { static int machine_stop_scope(Machine *m) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; - char *job; + char *job = NULL; int r; assert(m); @@ -410,7 +410,15 @@ int machine_kill(Machine *m, KillWho who, int signo) { if (!m->unit) return -ESRCH; - return manager_kill_unit(m->manager, m->unit, who, signo, NULL); + if (who == KILL_LEADER) { + /* If we shall simply kill the leader, do so directly */ + + if (kill(m->leader, signo) < 0) + return -errno; + } + + /* Otherwise make PID 1 do it for us, for the entire cgroup */ + return manager_kill_unit(m->manager, m->unit, signo, NULL); } static const char* const machine_class_table[_MACHINE_CLASS_MAX] = {