summaryrefslogtreecommitdiff
path: root/apps/app_externalivr.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2006-12-11 00:52:19 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2006-12-11 00:52:19 +0000
commitd670858735fce93f57eb72d3b8a0bba923015d31 (patch)
tree80cfa0cd4517050b2e78379b2f2710141f333d79 /apps/app_externalivr.c
parent23e606f70ab2fbcc66be3130ea5253731d82cbcd (diff)
Merged revisions 48375 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r48375 | tilghman | 2006-12-10 18:47:21 -0600 (Sun, 10 Dec 2006) | 13 lines Merged revisions 48374 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r48374 | tilghman | 2006-12-10 18:33:59 -0600 (Sun, 10 Dec 2006) | 5 lines When doing a fork() and exec(), two problems existed (Issue 8086): 1) Ignored signals stayed ignored after the exec(). 2) Signals could possibly fire between the fork() and exec(), causing Asterisk signal handlers within the child to execute, which caused nasty race conditions. ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48376 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_externalivr.c')
-rw-r--r--apps/app_externalivr.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c
index f9b890588..bcda8d663 100644
--- a/apps/app_externalivr.c
+++ b/apps/app_externalivr.c
@@ -40,6 +40,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <string.h>
#include <unistd.h>
#include <errno.h>
+#include <signal.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
@@ -262,9 +263,13 @@ static int app_exec(struct ast_channel *chan, void *data)
.finishlist = AST_LIST_HEAD_INIT_VALUE,
};
struct ivr_localuser *u = &foo;
+ sigset_t fullset, oldset;
lu = ast_module_user_add(chan);
-
+
+ sigfillset(&fullset);
+ pthread_sigmask(SIG_BLOCK, &fullset, &oldset);
+
u->abort_current_sound = 0;
u->chan = chan;
@@ -313,6 +318,9 @@ static int app_exec(struct ast_channel *chan, void *data)
/* child process */
int i;
+ signal(SIGPIPE, SIG_DFL);
+ pthread_sigmask(SIG_UNBLOCK, &fullset, NULL);
+
if (ast_opt_high_priority)
ast_set_priority(0);
@@ -336,6 +344,8 @@ static int app_exec(struct ast_channel *chan, void *data)
int waitfds[2] = { child_errors_fd, child_commands_fd };
struct ast_channel *rchan;
+ pthread_sigmask(SIG_SETMASK, &oldset, NULL);
+
close(child_stdin[0]);
child_stdin[0] = 0;
close(child_stdout[1]);