dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
3df8c3
diff -up util-linux-2.23.2/misc-utils/kill.c.kzak util-linux-2.23.2/misc-utils/kill.c
3df8c3
--- util-linux-2.23.2/misc-utils/kill.c.kzak	2013-06-13 09:46:10.448650861 +0200
3df8c3
+++ util-linux-2.23.2/misc-utils/kill.c	2014-09-25 10:08:27.879359310 +0200
3df8c3
@@ -48,6 +48,7 @@
3df8c3
 #include <ctype.h>		/* for isdigit() */
3df8c3
 #include <unistd.h>
3df8c3
 #include <signal.h>
3df8c3
+#include <errno.h>
3df8c3
 
3df8c3
 #include "c.h"
3df8c3
 #include "nls.h"
3df8c3
@@ -279,8 +280,9 @@ int main (int argc, char *argv[])
3df8c3
 	the rest of the arguments should be process ids and names.
3df8c3
 	kill them.  */
3df8c3
     for (errors = 0; (arg = *argv) != NULL; argv++) {
3df8c3
+	errno = 0;
3df8c3
 	pid = strtol (arg, &ep, 10);
3df8c3
-	if (! *ep)
3df8c3
+	if (errno == 0 && ep && *ep == '\0' && arg < ep)
3df8c3
 	    errors += kill_verbose (arg, pid, numsig);
3df8c3
 	else  {
3df8c3
 	    struct proc_processes *ps = proc_open_processes();