Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
patch for kill builtin
- X-seq: zsh-workers 30485
- From: Danek Duvall <duvall@xxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: patch for kill builtin
- Date: Mon, 21 May 2012 11:29:51 -0700
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Danek Duvall <duvall@xxxxxxxxxxxxxx>, zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
We had a bug report saying that "kill -9hello <pid>" simply killed <pid>
with SIGKILL, rather than reporting that "9hello" wasn't a proper signal
name like bash and ksh do. Since there's already code later on in
bin_kill() that recognizes this situation when you use -n, it was pretty
straightforward to copy the the code where -<number> was handled.
--- zsh-4.3.17/Src/jobs.c Sat Dec 10 14:40:56 2011
+++ zsh-4.3.17/Src/jobs.c Sat May 19 23:24:16 2012
@@ -2157,9 +2157,15 @@
/* 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);
+ 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;
Thanks,
Danek
Messages sorted by:
Reverse Date,
Date,
Thread,
Author