From d387ca777963e8907f50e8d5bc199ebd95329076 Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Tue, 4 Nov 2003 23:23:00 +0000 Subject: [PATCH] Handle mpg123 failures without leaking fd's git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1692 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_musiconhold.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 5ca4f5fbe1..f6a3d5b014 100755 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -163,6 +163,8 @@ static int spawn_mp3(struct mohclass *class) #endif if (!files) { ast_log(LOG_WARNING, "Found no files in '%s'\n", class->dir); + close(fds[0]); + close(fds[1]); return -1; } class->pid = fork(); @@ -189,6 +191,7 @@ static int spawn_mp3(struct mohclass *class) /* Check PATH as a last-ditch effort */ execvp("mpg123", argv); ast_log(LOG_WARNING, "Exec failed: %s\n", strerror(errno)); + close(fds[1]); exit(1); } else { /* Parent */