diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-06-20 04:37:17 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-06-20 04:37:17 +0000 |
commit | 5c6765ea521264fb8b81e4e86f6b4d88bded28f6 (patch) | |
tree | a7b22d607cc527f932dbf3bc8690cdb9c0734484 | |
parent | 9db4044fbdbf851b4766b5a903937dc6c3f891f5 (diff) | |
download | mpd-5c6765ea521264fb8b81e4e86f6b4d88bded28f6.tar.gz mpd-5c6765ea521264fb8b81e4e86f6b4d88bded28f6.tar.xz mpd-5c6765ea521264fb8b81e4e86f6b4d88bded28f6.zip |
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
-rw-r--r-- | src/main.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c index 063bc1032..6737030a3 100644 --- a/src/main.c +++ b/src/main.c @@ -205,17 +205,9 @@ void parseOptions(int argc, char ** argv, Options * options) { void closeAllFDs() { int i; + int fds = getdtablesize(); - for(i=0;i<FD_SETSIZE;i++) { - switch(i) { - case STDIN_FILENO: - case STDOUT_FILENO: - case STDERR_FILENO: - break; - default: - close(i); - } - } + for(i = 3; i < fds; i++) close(i); } void establishListen(Options * options) { |