]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
check to see if FD's are open before closing (bug #2858)
authorRussell Bryant <russell@russellbryant.com>
Thu, 18 Nov 2004 04:20:25 +0000 (04:20 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 18 Nov 2004 04:20:25 +0000 (04:20 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@4289 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_musiconhold.c

index 2dc39a5c65f85aaaab6decc1f3acbaa163961e5a..e3808da624cfd06c3d65115632f3cf67b1b3302b 100755 (executable)
@@ -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) {