diff options
Diffstat (limited to '')
-rw-r--r-- | mailutils/mail.c | 11 |
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) | |||
48 | xpipe(pipes); | 48 | xpipe(pipes); |
49 | xpipe(pipes + 2); | 49 | xpipe(pipes + 2); |
50 | 50 | ||
51 | // NB: handler must be installed before vfork | ||
52 | bb_signals(0 | ||
53 | + (1 << SIGCHLD) | ||
54 | + (1 << SIGALRM) | ||
55 | , signal_handler); | ||
56 | |||
51 | G.helper_pid = vfork(); | 57 | G.helper_pid = vfork(); |
52 | if (G.helper_pid < 0) | 58 | if (G.helper_pid < 0) |
53 | bb_perror_msg_and_die("vfork"); | 59 | bb_perror_msg_and_die("vfork"); |
@@ -60,15 +66,12 @@ void FAST_FUNC launch_helper(const char **argv) | |||
60 | 66 | ||
61 | if (!G.helper_pid) { | 67 | if (!G.helper_pid) { |
62 | // child: try to execute connection helper | 68 | // child: try to execute connection helper |
69 | // NB: SIGCHLD & SIGALRM revert to SIG_DFL on exec | ||
63 | BB_EXECVP(*argv, (char **)argv); | 70 | BB_EXECVP(*argv, (char **)argv); |
64 | _exit(127); | 71 | _exit(127); |
65 | } | 72 | } |
66 | 73 | ||
67 | // parent | 74 | // parent |
68 | bb_signals(0 | ||
69 | + (1 << SIGCHLD) | ||
70 | + (1 << SIGALRM) | ||
71 | , signal_handler); | ||
72 | // check whether child is alive | 75 | // check whether child is alive |
73 | //redundant:signal_handler(SIGCHLD); | 76 | //redundant:signal_handler(SIGCHLD); |
74 | // child seems OK -> parent goes on | 77 | // child seems OK -> parent goes on |