zsh-workers
 help / color / mirror / code / Atom feed
* patch for kill builtin
@ 2012-05-21 18:29 Danek Duvall
  0 siblings, 0 replies; only message in thread
From: Danek Duvall @ 2012-05-21 18:29 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-21 18:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21 18:29 patch for kill builtin Danek Duvall

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).