diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-11-17 18:16:08 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-11-17 18:16:08 +0000 |
commit | f096787f198d5f69adfc1a0463d0741aa9673e91 (patch) | |
tree | c78f67836b4ce0a23405571c6dc934ba2fd487ea /res | |
parent | de242cbd68e26137de7c7e7ef3c3b77b3c8e09e2 (diff) |
Check that FD's are open before closing (bug #2858)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4279 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rwxr-xr-x | res/res_musiconhold.c | 7 |
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) { |