From: Mark Spencer Date: Sun, 22 Aug 2004 18:33:19 +0000 (+0000) Subject: Fix sigchld handling (bug #2245) X-Git-Tag: 1.0.0~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60707a4172026a2598a800c9c09437ff107812f4;p=thirdparty%2Fasterisk.git Fix sigchld handling (bug #2245) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3633 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/asterisk.c b/asterisk.c index 71d1ee4484..691a3e4143 100755 --- a/asterisk.c +++ b/asterisk.c @@ -170,6 +170,12 @@ static int fdprint(int fd, const char *s) return write(fd, s, strlen(s) + 1); } +/* NULL handler so we can collect the child exit status */ +static void null_sig_handler(int signal) +{ + +} + int ast_safe_system(const char *s) { /* XXX This function needs some optimization work XXX */ @@ -178,6 +184,7 @@ int ast_safe_system(const char *s) int res; struct rusage rusage; int status; + void (*prev_handler) = signal(SIGCHLD, null_sig_handler); pid = fork(); if (pid == 0) { /* Close file descriptors and launch system command */ @@ -204,6 +211,7 @@ int ast_safe_system(const char *s) ast_log(LOG_WARNING, "Fork failed: %s\n", strerror(errno)); res = -1; } + signal(SIGCHLD, prev_handler); return res; }