diff options
author | Denys Vlasenko | 2011-02-07 02:03:51 +0100 |
---|---|---|
committer | Denys Vlasenko | 2011-02-07 02:03:51 +0100 |
commit | 8ee2adab21328761b80e0cbc513eda7eaa880b24 (patch) | |
tree | c771696ab3b1be735e831b1721ab751c874e1cd3 /shell/hush.c | |
parent | b8ab4b038803df195eee9844c3597dd640c00393 (diff) | |
download | busybox-8ee2adab21328761b80e0cbc513eda7eaa880b24.zip busybox-8ee2adab21328761b80e0cbc513eda7eaa880b24.tar.gz |
echo: do not retry on write errors
function old new delta
echo_main 297 336 +39
stpcpy - 22 +22
run_pipe 1561 1566 +5
pseudo_exec_argv 187 192 +5
hush_exit 75 80 +5
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 4/0 up/down: 98/0) Total: 76 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c index 10788b8..e857e74 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -1418,6 +1418,7 @@ static void sigexit(int sig) static void hush_exit(int exitcode) NORETURN; static void hush_exit(int exitcode) { + fflush_all(); if (G.exiting <= 0 && G.traps && G.traps[0] && G.traps[0][0]) { /* Prevent recursion: * trap "echo Hi; exit" EXIT; exit @@ -6105,10 +6106,13 @@ static void exec_builtin(char ***to_free, char **argv) { #if BB_MMU - int rcode = x->b_function(argv); + int rcode; + fflush_all(); + rcode = x->b_function(argv); fflush_all(); _exit(rcode); #else + fflush_all(); /* On NOMMU, we must never block! * Example: { sleep 99 | read line; } & echo Ok */ @@ -6832,6 +6836,7 @@ static NOINLINE int run_pipe(struct pipe *pi) if (!funcp) { debug_printf_exec(": builtin '%s' '%s'...\n", x->b_cmd, argv_expanded[1]); + fflush_all(); rcode = x->b_function(argv_expanded) & 0xff; fflush_all(); } @@ -7641,6 +7646,7 @@ int hush_main(int argc, char **argv) G.global_argc -= builtin_argc; /* skip [BARGV...] "" */ G.global_argv += builtin_argc; G.global_argv[-1] = NULL; /* replace "" */ + fflush_all(); G.last_exitcode = x->b_function(argv + optind - 1); } goto final_return; |