[git commit master 1/1] hush: do not print killer signal's name for SIGPIPE

Denys Vlasenko vda.linux at googlemail.com
Mon Feb 14 16:17:10 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=7c6f2468ccc849c9f8401ee97a3d894d8f483773
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/ash.c  |    1 +
 shell/hush.c |    6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index aaf21cd..cccd6dd 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -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)");
diff --git a/shell/hush.c b/shell/hush.c
index 00ef361..4d9e5f8 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -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;
-- 
1.7.3.4



More information about the busybox-cvs mailing list