summary refs log tree commit diff
path: root/Src/jobs.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/jobs.c')
-rw-r--r--Src/jobs.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Src/jobs.c b/Src/jobs.c
index b17060175..c9c549e1e 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -2164,10 +2164,15 @@ bin_kill(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
 
     /* check for, and interpret, a signal specifier */
     if (*argv && **argv == '-') {
-	if (idigit((*argv)[1]))
+	if (idigit((*argv)[1])) {
+	    char *endp;
 	    /* signal specified by number */
-	    sig = atoi(*argv + 1);
-	else if ((*argv)[1] != '-' || (*argv)[2]) {
+	    sig = zstrtol(*argv + 1, &endp, 10);
+	    if (*endp) {
+		zwarnnam(nam, "invalid signal number: %s", *argv);
+		return 1;
+	    }
+	} else if ((*argv)[1] != '-' || (*argv)[2]) {
 	    char *signame;
 
 	    /* with argument "-l" display the list of signal names */