[git commit] mail: launch_helper(): flush stdio before vfork, set G.helper_pid only in parent

Denys Vlasenko vda.linux at googlemail.com
Thu Dec 17 11:55:22 UTC 2020


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

function                                             old     new   delta
launch_helper                                        188     193      +5

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 mailutils/mail.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mailutils/mail.c b/mailutils/mail.c
index 7e9efdbfa..61e5053bc 100644
--- a/mailutils/mail.c
+++ b/mailutils/mail.c
@@ -46,7 +46,8 @@ void FAST_FUNC launch_helper(const char **argv)
 		+ (1 << SIGALRM)
 		, signal_handler);
 
-	G.helper_pid = pid = xvfork();
+	fflush_all();
+	pid = xvfork();
 	if (pid == 0) {
 		// child
 		close(child_in.wr);
@@ -59,6 +60,7 @@ void FAST_FUNC launch_helper(const char **argv)
 		// NB: SIGCHLD & SIGALRM revert to SIG_DFL on exec
 		BB_EXECVP_or_die((char**)argv);
 	}
+	G.helper_pid = pid;
 	close(child_out.wr);
 	close(child_in.rd);
 	xmove_fd(child_out.rd, STDIN_FILENO);


More information about the busybox-cvs mailing list