summaryrefslogtreecommitdiff
authorDenys Vlasenko <vda.linux@googlemail.com>2016-11-08 19:26:11 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2016-11-08 19:26:11 (GMT)
commit6c635d62d41477e92f0b30b0f525c7838e64a07d (patch)
treee7a4c92cd3c376baca692818bdf3e6d93907c0b1
parent5cc9bf6a21ae0738528c2fb301ff4be2ab662ee9 (diff)
downloadbusybox-6c635d62d41477e92f0b30b0f525c7838e64a07d.zip
busybox-6c635d62d41477e92f0b30b0f525c7838e64a07d.tar.gz
busybox-6c635d62d41477e92f0b30b0f525c7838e64a07d.tar.bz2
hush: small optimization in run_list
I thought gcc can detect this itself. It doesn't. function old new delta run_list 1030 1021 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat
-rw-r--r--shell/hush.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/shell/hush.c b/shell/hush.c
index a5f0599..5a36a76 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -8004,20 +8004,21 @@ static int run_list(struct pipe *pi)
G.last_bg_pid = pi->cmds[pi->num_cmds - 1].pid;
debug_printf_exec(": cmd&: exitcode EXIT_SUCCESS\n");
/* Check pi->pi_inverted? "! sleep 1 & echo $?": bash says 1. dash and ash says 0 */
- G.last_exitcode = rcode = EXIT_SUCCESS;
- check_and_run_traps();
+ rcode = EXIT_SUCCESS;
+ goto check_traps;
} else {
#if ENABLE_HUSH_JOB
if (G.run_list_level == 1 && G_interactive_fd) {
/* Waits for completion, then fg's main shell */
rcode = checkjobs_and_fg_shell(pi);
debug_printf_exec(": checkjobs_and_fg_shell exitcode %d\n", rcode);
- } else
-#endif
- { /* This one just waits for completion */
- rcode = checkjobs(pi, 0 /*(no pid to wait for)*/);
- debug_printf_exec(": checkjobs exitcode %d\n", rcode);
+ goto check_traps;
}
+#endif
+ /* This one just waits for completion */
+ rcode = checkjobs(pi, 0 /*(no pid to wait for)*/);
+ debug_printf_exec(": checkjobs exitcode %d\n", rcode);
+ check_traps:
G.last_exitcode = rcode;
check_and_run_traps();
}