aboutsummaryrefslogtreecommitdiffstats
path: root/asterisk.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-08-22 18:33:19 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-08-22 18:33:19 +0000
commit7dca52f480df43a69be269c07c40d111d2729a59 (patch)
tree76a95b10bfe61e3516bac1c187b6a6b7689b926f /asterisk.c
parentc5a188ba464e042e8a9ea851b8b74b1791360b19 (diff)
Fix sigchld handling (bug #2245)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3633 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rwxr-xr-xasterisk.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/asterisk.c b/asterisk.c
index 71d1ee448..691a3e414 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;
}