cdown / rpms / util-linux

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