core: correct handling of "systemctl kill --kill-who=main-fail"
--kill-who=main-fail never worked correctly, due to a copy and paste mistake inac5e3a505e, where the same item was listed twice. The mistake was later noticed, but fixed incorrectly, in201f0c916d. Let's list all *-fail types correctly, finally. And while we are at it, add a nice comment and generate a prettier D-Bus error about this.
This commit is contained in:
+3
-2
@@ -4381,8 +4381,9 @@ int unit_kill_common(
|
||||
killed = true;
|
||||
}
|
||||
|
||||
if (r == 0 && !killed && IN_SET(who, KILL_ALL_FAIL, KILL_CONTROL_FAIL))
|
||||
return -ESRCH;
|
||||
/* If the "fail" versions of the operation are requested, then complain if the set of processes we killed is empty */
|
||||
if (r == 0 && !killed && IN_SET(who, KILL_ALL_FAIL, KILL_CONTROL_FAIL, KILL_MAIN_FAIL))
|
||||
return sd_bus_error_set_const(error, BUS_ERROR_NO_SUCH_PROCESS, "No matching processes to kill");
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user