diff options
Diffstat (limited to 'apps/app_zapras.c')
-rw-r--r-- | apps/app_zapras.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/apps/app_zapras.c b/apps/app_zapras.c index cf770f2b7..91336f5e4 100644 --- a/apps/app_zapras.c +++ b/apps/app_zapras.c @@ -87,11 +87,23 @@ static pid_t spawn_ras(struct ast_channel *chan, char *args) char *argv[PPP_MAX_ARGS]; int argc = 0; char *stringp=NULL; + sigset_t fullset, oldset; + + sigfillset(&fullset); + pthread_sigmask(SIG_BLOCK, &fullset, &oldset); /* Start by forking */ pid = fork(); - if (pid) + if (pid) { + pthread_sigmask(SIG_SETMASK, &oldset, NULL); return pid; + } + + /* Restore original signal handlers */ + for (x=0;x<NSIG;x++) + signal(x, SIG_DFL); + + pthread_sigmask(SIG_UNBLOCK, &fullset, NULL); /* Execute RAS on File handles */ dup2(chan->fds[0], STDIN_FILENO); @@ -104,10 +116,6 @@ static pid_t spawn_ras(struct ast_channel *chan, char *args) for (x=STDERR_FILENO + 1;x<1024;x++) close(x); - /* Restore original signal handlers */ - for (x=0;x<NSIG;x++) - signal(x, SIG_DFL); - /* Reset all arguments */ memset(argv, 0, sizeof(argv)); |