]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/service: check error first and log about errno 29623/head
authorMike Yuan <me@yhndnzj.com>
Wed, 18 Oct 2023 15:29:00 +0000 (23:29 +0800)
committerMike Yuan <me@yhndnzj.com>
Thu, 19 Oct 2023 13:37:39 +0000 (21:37 +0800)
Follow-up for becdfcb9f1cb555c50dcfe51894cb0b155f7f01e

src/core/service.c

index 02a35bb4ffdd5e8faac9dd7491255f010c5397bc..54090251a90e33f2f2a5caf8f7faa095cb5e0f3f 100644 (file)
@@ -1074,10 +1074,10 @@ static int service_is_suitable_main_pid(Service *s, PidRef *pid, int prio) {
                 return log_unit_full_errno(UNIT(s), prio, SYNTHETIC_ERRNO(EPERM), "New main PID "PID_FMT" is the control process, refusing.", pid->pid);
 
         r = pidref_is_alive(pid);
+        if (r < 0)
+                return log_unit_full_errno(UNIT(s), prio, r, "Failed to check if main PID "PID_FMT" exists or is a zombie: %m", pid->pid);
         if (r == 0)
                 return log_unit_full_errno(UNIT(s), prio, SYNTHETIC_ERRNO(ESRCH), "New main PID "PID_FMT" does not exist or is a zombie.", pid->pid);
-        if (r < 0)
-                return log_unit_full_errno(UNIT(s), prio, r, "Failed to check if main PID "PID_FMT" exists or is a zombie.", pid->pid);
 
         owner = manager_get_unit_by_pidref(UNIT(s)->manager, pid);
         if (owner == UNIT(s)) {