[Pkg-sysvinit-commits] r216 - sysvinit/trunk/src
Thomas Hood
jdthood-guest at costa.debian.org
Wed Nov 23 18:39:29 UTC 2005
Author: jdthood-guest
Date: 2005-11-23 18:39:29 +0000 (Wed, 23 Nov 2005)
New Revision: 216
Modified:
sysvinit/trunk/src/killall5.c
Log:
Exit from pidof quickly if program name or its basename is null
Modified: sysvinit/trunk/src/killall5.c
===================================================================
--- sysvinit/trunk/src/killall5.c 2005-11-23 15:09:53 UTC (rev 215)
+++ sysvinit/trunk/src/killall5.c 2005-11-23 18:39:29 UTC (rev 216)
@@ -378,18 +378,22 @@
int foundone = 0;
int ok = 0;
- /* Try to stat the executable. */
- if (prog[0] == '/' && stat(prog, &st) == 0) dostat++;
-
/* Get basename of program. */
if ((s = strrchr(prog, '/')) == NULL)
s = prog;
else
s++;
+ if (! *s)
+ return NULL;
+
q = (PIDQ_HEAD *)xmalloc(sizeof(PIDQ_HEAD));
q = init_pid_q(q);
+ /* Try to stat the executable. */
+ if (prog[0] == '/' && stat(prog, &st) == 0)
+ dostat++;
+
/* First try to find a match based on dev/ino pair. */
if (dostat) {
for (p = plist; p; p = p->next) {
More information about the Pkg-sysvinit-commits
mailing list