aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-12-17 12:55:22 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-12-17 12:55:22 +0100
commitcd48f071173c2b24ae49f2b6eb35a76734f2d86b (patch)
tree6611dcae6293b759a963c5bdb56e371c9b93d382
parentb0e7cb4c3f1bd9872444711ebc44258430156cad (diff)
downloadbusybox-w32-cd48f071173c2b24ae49f2b6eb35a76734f2d86b.tar.gz
busybox-w32-cd48f071173c2b24ae49f2b6eb35a76734f2d86b.tar.bz2
busybox-w32-cd48f071173c2b24ae49f2b6eb35a76734f2d86b.zip
mail: launch_helper(): flush stdio before vfork, set G.helper_pid only in parent
function old new delta launch_helper 188 193 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--mailutils/mail.c4
1 files changed, 3 insertions, 1 deletions
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)
46 + (1 << SIGALRM) 46 + (1 << SIGALRM)
47 , signal_handler); 47 , signal_handler);
48 48
49 G.helper_pid = pid = xvfork(); 49 fflush_all();
50 pid = xvfork();
50 if (pid == 0) { 51 if (pid == 0) {
51 // child 52 // child
52 close(child_in.wr); 53 close(child_in.wr);
@@ -59,6 +60,7 @@ void FAST_FUNC launch_helper(const char **argv)
59 // NB: SIGCHLD & SIGALRM revert to SIG_DFL on exec 60 // NB: SIGCHLD & SIGALRM revert to SIG_DFL on exec
60 BB_EXECVP_or_die((char**)argv); 61 BB_EXECVP_or_die((char**)argv);
61 } 62 }
63 G.helper_pid = pid;
62 close(child_out.wr); 64 close(child_out.wr);
63 close(child_in.rd); 65 close(child_in.rd);
64 xmove_fd(child_out.rd, STDIN_FILENO); 66 xmove_fd(child_out.rd, STDIN_FILENO);