hush: do not print killer signal's name for SIGPIPE
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 14 Feb 2011 16:17:10 +0000 (17:17 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 14 Feb 2011 16:17:10 +0000 (17:17 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c
shell/hush.c

index aaf21cd6fc745ba8ecd1f2721b770f72e44caf1d..cccd6dd79393b749284fa9596dc59dcc0e592efa 100644 (file)
@@ -3892,6 +3892,7 @@ sprint_status(char *s, int status, int sigonly)
 #endif
                }
                st &= 0x7f;
+//TODO: use bbox's get_signame? strsignal adds ~600 bytes to text+rodata
                col = fmtstr(s, 32, strsignal(st));
                if (WCOREDUMP(status)) {
                        col += fmtstr(s + col, 16, " (core dumped)");
index 00ef361cd7473af32acfd207d2e854967639bd56..4d9e5f8c7c7dc928159fc140b922f08978eafc67 100644 (file)
@@ -6504,13 +6504,15 @@ static int checkjobs(struct pipe *fg_pipe)
                                        fg_pipe->alive_cmds--;
                                        ex = WEXITSTATUS(status);
                                        /* bash prints killer signal's name for *last*
-                                        * process in pipe (prints just newline for SIGINT).
+                                        * process in pipe (prints just newline for SIGINT/SIGPIPE).
                                         * Mimic this. Example: "sleep 5" + (^\ or kill -QUIT)
                                         */
                                        if (WIFSIGNALED(status)) {
                                                int sig = WTERMSIG(status);
                                                if (i == fg_pipe->num_cmds-1)
-                                                       printf("%s\n", sig == SIGINT ? "" : get_signame(sig));
+                                                       /* TODO: use strsignal() instead for bash compat? but that's bloat... */
+                                                       printf("%s\n", sig == SIGINT || sig == SIGPIPE ? "" : get_signame(sig));
+                                               /* TODO: if (WCOREDUMP(status)) + " (core dumped)"; */
                                                /* TODO: MIPS has 128 sigs (1..128), what if sig==128 here?
                                                 * Maybe we need to use sig | 128? */
                                                ex = sig + 128;