cdown / rpms / util-linux

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