]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
unit: minor simplification
authorLennart Poettering <lennart@poettering.net>
Fri, 28 Aug 2015 16:29:02 +0000 (18:29 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 31 Aug 2015 11:20:43 +0000 (13:20 +0200)
src/core/unit.c

index 9afb5736d7a6e7271d3299eac82197b6c8f1bd42..5f602bdf5f8d143bbfa5502fcdfb3f9618339ba5 100644 (file)
@@ -3135,17 +3135,17 @@ int unit_kill_common(
 
         int r = 0;
 
-        if (who == KILL_MAIN && main_pid <= 0) {
+        if (who == KILL_MAIN) {
                 if (main_pid < 0)
                         return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_PROCESS, "%s units have no main processes", unit_type_to_string(u->type));
-                else
+                else if (main_pid == 0)
                         return sd_bus_error_set_const(error, BUS_ERROR_NO_SUCH_PROCESS, "No main process to kill");
         }
 
-        if (who == KILL_CONTROL && control_pid <= 0) {
+        if (who == KILL_CONTROL) {
                 if (control_pid < 0)
                         return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_PROCESS, "%s units have no control processes", unit_type_to_string(u->type));
-                else
+                else if (control_pid == 0)
                         return sd_bus_error_set_const(error, BUS_ERROR_NO_SUCH_PROCESS, "No control process to kill");
         }