aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_musiconhold.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_musiconhold.c')
-rwxr-xr-xres/res_musiconhold.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 2dc39a5c6..e3808da62 100755
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -224,8 +224,11 @@ static int spawn_mp3(struct mohclass *class)
/* Stdout goes to pipe */
dup2(fds[1], STDOUT_FILENO);
/* Close unused file descriptors */
- for (x=3;x<8192;x++)
- close(x);
+ for (x=3;x<8192;x++) {
+ if (-1 != fcntl(x, F_GETFL)) {
+ close(x);
+ }
+ }
/* Child */
chdir(class->dir);
if(class->custom) {