Handle mpg123 failures without leaking fd's

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1692 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2003-11-04 23:23:00 +00:00
parent fa45f2e6ba
commit d387ca7779

View File

@@ -163,6 +163,8 @@ static int spawn_mp3(struct mohclass *class)
#endif #endif
if (!files) { if (!files) {
ast_log(LOG_WARNING, "Found no files in '%s'\n", class->dir); ast_log(LOG_WARNING, "Found no files in '%s'\n", class->dir);
close(fds[0]);
close(fds[1]);
return -1; return -1;
} }
class->pid = fork(); class->pid = fork();
@@ -189,6 +191,7 @@ static int spawn_mp3(struct mohclass *class)
/* Check PATH as a last-ditch effort */ /* Check PATH as a last-ditch effort */
execvp("mpg123", argv); execvp("mpg123", argv);
ast_log(LOG_WARNING, "Exec failed: %s\n", strerror(errno)); ast_log(LOG_WARNING, "Exec failed: %s\n", strerror(errno));
close(fds[1]);
exit(1); exit(1);
} else { } else {
/* Parent */ /* Parent */