[Toybox] Small fix for xpidfile()

Felix Janda felix.janda at posteo.de
Sun Sep 1 06:16:44 PDT 2013


# HG changeset patch
# User Felix Janda <felix.janda at posteo.de>
# Date 1378041238 -7200
# Node ID 587b7572aac2a64988503458155e1f2546672525
# Parent  3cd61d16aabec82505da96a142663cedbba8d12a
fix for xpidfile()

diff -r 3cd61d16aabe -r 587b7572aac2 lib/xwrap.c
--- a/lib/xwrap.c	Sat Aug 31 12:30:41 2013 +0200
+++ b/lib/xwrap.c	Sun Sep 01 15:13:58 2013 +0200
@@ -463,7 +463,7 @@
     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) == -1 && errno == ESRCH)) unlink(pidfile);
 
     // An else with more sanity checking might be nice here.
   }

 1378041404.0


More information about the Toybox mailing list