aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/kill.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix/kill.c')
-rw-r--r--toys/posix/kill.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/toys/posix/kill.c b/toys/posix/kill.c
index 2eaba031..2f47f60f 100644
--- a/toys/posix/kill.c
+++ b/toys/posix/kill.c
@@ -144,8 +144,9 @@ void kill_main(void)
while (*args) {
char *arg = *(args++);
- pid = strtol(arg, &tmp, 10);
- if (*tmp || kill(pid, signum) < 0) error_msg("unknown pid '%s'", arg);
+ pid = estrtol(arg, &tmp, 10);
+ if (!errno && *tmp) errno = ESRCH;
+ if (errno || kill(pid, signum)<0) perror_msg("bad pid '%s'", arg);
}
}
}