[git commit] nofork: fix a bug uncovered by hush testsuite (forgotten fflush)

Denys Vlasenko vda.linux at googlemail.com
Thu Aug 3 17:52:47 UTC 2017


commit: https://git.busybox.net/busybox/commit/?id=19c9f31af17f2c34e93c9c322b5c546ffbcda6ad
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
run_nofork_applet                                    280     287      +7

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/vfork_daemon_rexec.c | 2 ++
 shell/hush_test/run-all    | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index 487ecb0..98512bb 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -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 */
 	}
diff --git a/shell/hush_test/run-all b/shell/hush_test/run-all
index 1dd0edc..3fbc7c5 100755
--- a/shell/hush_test/run-all
+++ b/shell/hush_test/run-all
@@ -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}


More information about the busybox-cvs mailing list