[Asterisk-cvs] asterisk/res res_musiconhold.c,1.39,1.40

markster at lists.digium.com markster at lists.digium.com
Wed Nov 17 13:15:40 CST 2004


Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv23846/res

Modified Files:
	res_musiconhold.c 
Log Message:
Check that FD's are open before closing (bug #2858)


Index: res_musiconhold.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_musiconhold.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- res_musiconhold.c	7 Sep 2004 01:22:57 -0000	1.39
+++ res_musiconhold.c	17 Nov 2004 18:16:08 -0000	1.40
@@ -224,8 +224,11 @@
 		/* 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) {




More information about the svn-commits mailing list