static int spw,spr; /* file descriptors for signal notification pipe */
-static void set_default_signals(void);
-
/* Long-lived subprocesses can only be started once we've started
signal processing so that we can catch SIGCHLD for them and report
their exit status using the callback function. We block SIGCHLD
p=fork();
if (p==0) {
/* Child process */
- set_default_signals();
- sigprocmask(SIG_SETMASK,&emptyset,NULL);
+ afterfork();
entry(est);
abort();
} else if (p==-1) {
if the execvp() fails this seems somewhat pointless, and
increases the chance of the child process failing before it
gets to exec(). */
+ afterfork();
va_start(ap,arg);
args[0]=(char *)arg; /* program name */
i=1;
}
}
-static void set_default_signals(void)
+void afterfork(void)
{
struct signotify *n;
sigset_t done;
sa.sa_flags=0;
sigaction(n->signum,&sa,NULL);
}
+
+ sigemptyset(&emptyset);
+ sigprocmask(SIG_SETMASK,&emptyset,NULL);
}
static void signal_handler(int signum)
/* from process.c */
extern void start_signal_handling(void);
+void afterfork(void);
+/* Must be called before exec in every child made after
+ start_signal_handling. Safe to call in earlier children too. */
+
/***** CONFIGURATION support *****/
extern bool_t just_check_config; /* If True then we're going to exit after
char *argv[5], addrstr[33], portstr[5];
const char *addrfam;
int port;
+ afterfork();
switch (addr->sa.sa_family) {
case AF_INET:
sprintf(addrstr,"%08lX",(long)addr->sin.sin_addr.s_addr);