Fix for xpidfile spotted by Felix Janda.
authorRob Landley <rob@landley.net>
Fri, 6 Sep 2013 09:45:36 +0000 (04:45 -0500)
committerRob Landley <rob@landley.net>
Fri, 6 Sep 2013 09:45:36 +0000 (04:45 -0500)
lib/xwrap.c

index 90c4d86..fdd2db4 100644 (file)
@@ -463,7 +463,7 @@ void xpidfile(char *name)
     spid[xread(fd, spid, sizeof(spid)-1)] = 0;
     close(fd);
     pid = atoi(spid);
-    if (pid < 1 || kill(pid, 0) == ESRCH) unlink(pidfile);
+    if (pid < 1 || (kill(pid, 0) && errno == ESRCH)) unlink(pidfile);
 
     // An else with more sanity checking might be nice here.
   }