From 5c6765ea521264fb8b81e4e86f6b4d88bded28f6 Mon Sep 17 00:00:00 2001 From: Warren Dukes <warren.dukes@gmail.com> Date: Sun, 20 Jun 2004 04:37:17 +0000 Subject: 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 --- src/main.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/main.c') 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) { -- cgit v1.2.3