aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main.c12
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) {