summaryrefslogtreecommitdiff
path: root/mailutils/mail.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-03-10 16:01:57 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-03-10 16:01:57 +0000
commit4774179cb9e04030485773adf2b7b1055a10faeb (patch)
tree91bb5c51f9f4e3036298d7bb5490621b3e7a3ee6 /mailutils/mail.c
parent245f91b6494063c5fa1f3f586771e2ac100a69a9 (diff)
downloadbusybox-4774179cb9e04030485773adf2b7b1055a10faeb.tar.gz
mail.c: more robust handling of SIGCHLD
init: more robust signal handling
Diffstat (limited to 'mailutils/mail.c')
-rw-r--r--mailutils/mail.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/mailutils/mail.c b/mailutils/mail.c
index 71f46c86f..68883ff42 100644
--- a/mailutils/mail.c
+++ b/mailutils/mail.c
@@ -48,6 +48,12 @@ void FAST_FUNC launch_helper(const char **argv)
xpipe(pipes);
xpipe(pipes + 2);
+ // NB: handler must be installed before vfork
+ bb_signals(0
+ + (1 << SIGCHLD)
+ + (1 << SIGALRM)
+ , signal_handler);
+
G.helper_pid = vfork();
if (G.helper_pid < 0)
bb_perror_msg_and_die("vfork");
@@ -60,15 +66,12 @@ void FAST_FUNC launch_helper(const char **argv)
if (!G.helper_pid) {
// child: try to execute connection helper
+ // NB: SIGCHLD & SIGALRM revert to SIG_DFL on exec
BB_EXECVP(*argv, (char **)argv);
_exit(127);
}
// parent
- bb_signals(0
- + (1 << SIGCHLD)
- + (1 << SIGALRM)
- , signal_handler);
// check whether child is alive
//redundant:signal_handler(SIGCHLD);
// child seems OK -> parent goes on