svn commit: trunk/busybox/debianutils
landley at busybox.net
landley at busybox.net
Mon Sep 4 18:59:40 UTC 2006
Author: landley
Date: 2006-09-04 11:59:39 -0700 (Mon, 04 Sep 2006)
New Revision: 16047
Log:
Patch from Natanael Copa to make start-stop-daemon just use readlink and
strcmp to check if a program is already running.
Modified:
trunk/busybox/debianutils/start_stop_daemon.c
Changeset:
Modified: trunk/busybox/debianutils/start_stop_daemon.c
===================================================================
--- trunk/busybox/debianutils/start_stop_daemon.c 2006-09-04 02:34:00 UTC (rev 16046)
+++ trunk/busybox/debianutils/start_stop_daemon.c 2006-09-04 18:59:39 UTC (rev 16047)
@@ -39,16 +39,17 @@
static int pid_is_exec(pid_t pid, const char *name)
{
- char buf[32];
- struct stat sb, exec_stat;
+ char buf[32], *execbuf;
+ int equal;
- if (name)
- xstat(name, &exec_stat);
-
sprintf(buf, "/proc/%d/exe", pid);
- if (stat(buf, &sb) != 0)
- return 0;
- return (sb.st_dev == exec_stat.st_dev && sb.st_ino == exec_stat.st_ino);
+ execbuf = xstrdup(name);
+ readlink(buf, execbuf, strlen(name)+1);
+
+ equal = ! strcmp(execbuf, name);
+ if (ENABLE_FEATURE_CLEAN_UP)
+ free(execbuf);
+ return equal;
}
static int pid_is_user(int pid, int uid)
More information about the busybox-cvs
mailing list