]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
process-util: ensure pidref_is_alive only return ESRCH if not set
authorMike Yuan <me@yhndnzj.com>
Sat, 23 Dec 2023 11:08:22 +0000 (19:08 +0800)
committerMike Yuan <me@yhndnzj.com>
Thu, 4 Jan 2024 08:19:20 +0000 (16:19 +0800)
src/basic/process-util.c

index 201c5596ae9f969ee771395189b036c52a59d4e8..cdfe33c1dbd76b6c3e90898587431eb0e0d0d78c 100644 (file)
@@ -1112,8 +1112,10 @@ int pidref_is_alive(const PidRef *pidref) {
                 return -ESRCH;
 
         result = pid_is_alive(pidref->pid);
-        if (result < 0)
+        if (result < 0) {
+                assert(result != -ESRCH);
                 return result;
+        }
 
         r = pidref_verify(pidref);
         if (r == -ESRCH)