mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-20 08:40:16 +00:00
Check that FD's are open before closing (bug #2858)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4279 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -224,8 +224,11 @@ static int spawn_mp3(struct mohclass *class)
|
|||||||
/* Stdout goes to pipe */
|
/* Stdout goes to pipe */
|
||||||
dup2(fds[1], STDOUT_FILENO);
|
dup2(fds[1], STDOUT_FILENO);
|
||||||
/* Close unused file descriptors */
|
/* Close unused file descriptors */
|
||||||
for (x=3;x<8192;x++)
|
for (x=3;x<8192;x++) {
|
||||||
close(x);
|
if (-1 != fcntl(x, F_GETFL)) {
|
||||||
|
close(x);
|
||||||
|
}
|
||||||
|
}
|
||||||
/* Child */
|
/* Child */
|
||||||
chdir(class->dir);
|
chdir(class->dir);
|
||||||
if(class->custom) {
|
if(class->custom) {
|
||||||
|
|||||||
Reference in New Issue
Block a user