nofork: fix a bug uncovered by hush testsuite (forgotten fflush)
authorDenys Vlasenko <vda.linux@googlemail.com>
Thu, 3 Aug 2017 17:52:47 +0000 (19:52 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 3 Aug 2017 17:52:47 +0000 (19:52 +0200)
function                                             old     new   delta
run_nofork_applet                                    280     287      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb/vfork_daemon_rexec.c
shell/hush_test/run-all

index 487ecb0e4ffeb4b03e45bb01efe644b5765b04e5..98512bb000480727e7c2cfd7c1fd61a82a521ad3 100644 (file)
@@ -143,6 +143,8 @@ int FAST_FUNC run_nofork_applet(int applet_no, char **argv)
                applet_name = tmp_argv[0];
                /* Finally we can call NOFORK applet's main() */
                rc = applet_main[applet_no](argc, tmp_argv);
+               /* Important for shells: `which CMD` was failing */
+               fflush_all();
        } else {
                /* xfunc died in NOFORK applet */
        }
index 1dd0edc39bd49f412482b9b2356a28cd35ff02a4..3fbc7c531b3e369c508d001f1b23bd56194ae2c1 100755 (executable)
@@ -80,7 +80,7 @@ do_test()
                case $? in
                        0)  echo " ok";;
                        77) echo " skip (feature disabled)";;
-                       *)  echo " fail"; tret=1;;
+                       *)  echo " fail ($?)"; tret=1;;
                esac
        done
        exit ${tret}