diff options
Diffstat (limited to 'apps/app_mp3.c')
-rw-r--r-- | apps/app_mp3.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/apps/app_mp3.c b/apps/app_mp3.c index 31fc32096..1cba886bb 100644 --- a/apps/app_mp3.c +++ b/apps/app_mp3.c @@ -67,15 +67,25 @@ static int mp3play(char *filename, int fd) { int res; int x; + sigset_t fullset, oldset; + + sigfillset(&fullset); + pthread_sigmask(SIG_BLOCK, &fullset, &oldset); + res = fork(); if (res < 0) ast_log(LOG_WARNING, "Fork failed\n"); - if (res) + if (res) { + pthread_sigmask(SIG_SETMASK, &oldset, NULL); return res; + } if (option_highpriority) ast_set_priority(0); + signal(SIGPIPE, SIG_DFL); + pthread_sigmask(SIG_UNBLOCK, &fullset, NULL); + dup2(fd, STDOUT_FILENO); - for (x=0;x<256;x++) { + for (x=STDERR_FILENO + 1;x<256;x++) { if (x != STDOUT_FILENO) close(x); } @@ -97,7 +107,7 @@ static int mp3play(char *filename, int fd) execlp("mpg123", "mpg123", "-q", "-s", "-f", "8192", "--mono", "-r", "8000", filename, (char *)NULL); } ast_log(LOG_WARNING, "Execute of mpg123 failed\n"); - return -1; + _exit(0); } static int timed_read(int fd, void *data, int datalen, int timeout) |