The following commit has been merged in the master branch:
commit b5c0381ff4d7508368a897ed375f9ae509fef56b
Author: Guillem Jover <[EMAIL PROTECTED]>
Date: Sun Aug 3 22:01:38 2008 +0300
s-s-d: Use kill instead of /proc to check for pid existence
diff --git a/ChangeLog b/ChangeLog
index 1034e8c..47e4299 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2008-08-03 Guillem Jover <[EMAIL PROTECTED]>
+ * utils/start-stop-daemon.c (pid_is_running) [!OSHURD]: Reimplement
+ using kill instead of less-portable /proc.
+
+2008-08-03 Guillem Jover <[EMAIL PROTECTED]>
+
* utils/start-stop-daemon.c (check) [HAVE_KVM_H]: Call pid_is_exec.
2008-08-03 Guillem Jover <[EMAIL PROTECTED]>
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index cb37932..7890b08 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -904,17 +904,12 @@ pid_is_running(pid_t pid)
static int
pid_is_running(pid_t pid)
{
- struct stat sb;
- char buf[32];
-
- sprintf(buf, "/proc/%d", pid);
- if (stat(buf, &sb) != 0) {
- if (errno != ENOENT)
- fatal("Error stating %s: %s", buf, strerror(errno));
+ if (kill(pid, 0) == 0 || errno == EPERM)
+ return 1;
+ else if (errno == ESRCH)
return 0;
- }
-
- return 1;
+ else
+ fatal("Error checking pid %u status: %s", pid, strerror(errno));
}
#endif
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]