cdown / rpms / util-linux

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