aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-11-04 23:23:00 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-11-04 23:23:00 +0000
commit6461b806047e9187792646ad68d1ee492665d1b5 (patch)
tree54f3c02f71d030ec8a32f6cf03da392a26e8b346 /res
parenta52f32402c323dd0ef29aa501de8269a708fa98c (diff)
Handle mpg123 failures without leaking fd's
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1692 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rwxr-xr-xres/res_musiconhold.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 5ca4f5fbe..f6a3d5b01 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 */