ash: [SHELL] Move flushall to the point just before _exit
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 25 Oct 2016 18:49:53 +0000 (20:49 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 25 Oct 2016 18:49:53 +0000 (20:49 +0200)
Upstream commit:

    We need to flush at the very end in case we've generated any errors
    before that.  The flushall call cannot perform a longjmp so it's
    safe there.

    Date: Sat, 22 Sep 2007 20:50:21 +0800
    [SHELL] Move flushall to the point just before _exit

    We need to flush at the very end in case we've generated any errors
    before that.  The flushall call cannot perform a longjmp so it's
    safe there.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c

index b7f20ba36f4e52885013cc2c12e3b720ebd700ed..3f1405d81ffb84b3c0762b38138360da6a2c13dc 100644 (file)
@@ -13187,12 +13187,12 @@ exitshell(void)
                evalstring(p, 0);
                /*free(p); - we'll exit soon */
        }
-       flush_stdout_stderr();
  out:
        /* dash wraps setjobctl(0) in "if (setjmp(loc.loc) == 0) {...}".
         * our setjobctl(0) does not panic if tcsetpgrp fails inside it.
         */
        setjobctl(0);
+       flush_stdout_stderr();
        _exit(status);
        /* NOTREACHED */
 }