summaryrefslogtreecommitdiff
path: root/networking/sendmail.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-07-01 15:59:42 +0000
committerDenis Vlasenko2008-07-01 15:59:42 +0000
commit82604e973085f91f1b99cacea08963d0d1468084 (patch)
tree2de05bb2a6943ca6be0cc46f36e5fb07099aef40 /networking/sendmail.c
parentb111917972c1398ef96ef2d388c6c4ba57a8e9f7 (diff)
downloadbusybox-82604e973085f91f1b99cacea08963d0d1468084.zip
busybox-82604e973085f91f1b99cacea08963d0d1468084.tar.gz
revert last two commits. vfork cannot be used in subroutine,
it trashes stack on return
Diffstat (limited to 'networking/sendmail.c')
-rw-r--r--networking/sendmail.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/networking/sendmail.c b/networking/sendmail.c
index c195cc0..1c23ca2 100644
--- a/networking/sendmail.c
+++ b/networking/sendmail.c
@@ -120,6 +120,15 @@ static void signal_handler(int signo)
#undef err
}
+/* libbb candidate */
+static pid_t vfork_or_die(void)
+{
+ pid_t pid = vfork();
+ if (pid < 0)
+ bb_perror_msg_and_die("vfork");
+ return pid;
+}
+
static void launch_helper(const char **argv)
{
// setup vanilla unidirectional pipes interchange
@@ -128,7 +137,7 @@ static void launch_helper(const char **argv)
xpipe(pipes);
xpipe(pipes+2);
- helper_pid = xvfork();
+ helper_pid = vfork_or_die();
idx = (!helper_pid) * 2;
xdup2(pipes[idx], STDIN_FILENO);
xdup2(pipes[3-idx], STDOUT_FILENO);