[Asterisk-cvs] asterisk asterisk.c,1.20,1.21
markster at lists.digium.com
markster at lists.digium.com
Tue Sep 16 14:34:48 CDT 2003
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv23699
Modified Files:
asterisk.c
Log Message:
Improve child process reaping (bug #278)
Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- asterisk.c 8 Sep 2003 16:48:06 -0000 1.20
+++ asterisk.c 16 Sep 2003 19:35:56 -0000 1.21
@@ -337,11 +337,19 @@
ast_module_reload();
}
-
-static void pipe_handler(int num)
+static void child_handler(int sig)
{
- /* Ignore sigpipe */
+ int n, status;
+
+ /*
+ * Reap all dead children -- not just one
+ */
+ for (n = 0; wait4(-1, &status, WNOHANG, NULL) > 0; n++)
+ ;
+ if (n == 0 && option_debug)
+ ast_log(LOG_DEBUG, "Huh? Child handler, but nobody there?\n");
}
+
static void set_title(char *text)
{
/* Set an X-term or screen title */
@@ -1366,11 +1374,14 @@
}
if (option_console && !option_verbose)
ast_verbose("[ Booting...");
+
signal(SIGURG, urg_handler);
signal(SIGINT, __quit_handler);
signal(SIGTERM, __quit_handler);
signal(SIGHUP, hup_handler);
- signal(SIGPIPE, pipe_handler);
+ signal(SIGCHLD, child_handler);
+ signal(SIGPIPE, SIG_IGN);
+
if (set_priority(option_highpriority)) {
printf(term_quit());
exit(1);
More information about the svn-commits
mailing list