use getdtablesize() to get the max number of fd's
git-svn-id: https://svn.musicpd.org/mpd/trunk@1579 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
9db4044fbd
commit
5c6765ea52
12
src/main.c
12
src/main.c
@ -205,17 +205,9 @@ void parseOptions(int argc, char ** argv, Options * options) {
|
|||||||
|
|
||||||
void closeAllFDs() {
|
void closeAllFDs() {
|
||||||
int i;
|
int i;
|
||||||
|
int fds = getdtablesize();
|
||||||
|
|
||||||
for(i=0;i<FD_SETSIZE;i++) {
|
for(i = 3; i < fds; i++) close(i);
|
||||||
switch(i) {
|
|
||||||
case STDIN_FILENO:
|
|
||||||
case STDOUT_FILENO:
|
|
||||||
case STDERR_FILENO:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
close(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void establishListen(Options * options) {
|
void establishListen(Options * options) {
|
||||||
|
Loading…
Reference in New Issue
Block a user