aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_festival.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-16 22:57:54 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-16 22:57:54 +0000
commitd9fc402428c10315d158f7cf960c9592276b3c82 (patch)
tree6dea5b8c8d8bb81a47195b75172db608ff217382 /apps/app_festival.c
parentc99aa3db824dfb5a6eddf4d7d96685e8eb1767d6 (diff)
Standardized routines for forking processes (keeps all the specialized code in one place).
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@114188 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_festival.c')
-rw-r--r--apps/app_festival.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/apps/app_festival.c b/apps/app_festival.c
index e788291ed..096b34c25 100644
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -117,30 +117,20 @@ static char *socket_receive_file_to_buff(int fd, int *size)
static int send_waveform_to_fd(char *waveform, int length, int fd)
{
int res;
- int x;
#ifdef __PPC__
char c;
#endif
- sigset_t fullset, oldset;
- sigfillset(&fullset);
- pthread_sigmask(SIG_BLOCK, &fullset, &oldset);
-
- res = fork();
+ res = ast_safe_fork(0);
if (res < 0)
ast_log(LOG_WARNING, "Fork failed\n");
if (res) {
- pthread_sigmask(SIG_SETMASK, &oldset, NULL);
return res;
}
- for (x = 0; x < 256; x++) {
- if (x != fd)
- close(x);
- }
+ dup2(fd, 0);
+ ast_close_fds_above_n(0);
if (ast_opt_high_priority)
ast_set_priority(0);
- signal(SIGPIPE, SIG_DFL);
- pthread_sigmask(SIG_UNBLOCK, &fullset, NULL);
#ifdef __PPC__
for (x = 0; x < length; x += 2) {
c = *(waveform + x + 1);