Browse Source

Fix #781

pull/807/head
Max Lv 8 years ago
parent
commit
9a43cc6e6b
4 changed files with 52 additions and 40 deletions
  1. 23
      src/local.c
  2. 23
      src/redir.c
  3. 23
      src/server.c
  4. 23
      src/tunnel.c

23
src/local.c

@ -1181,16 +1181,6 @@ int main(int argc, char **argv)
if (nofile == 0) { if (nofile == 0) {
nofile = conf->nofile; nofile = conf->nofile;
} }
/*
* no need to check the return value here since we will show
* the user an error message if setrlimit(2) fails
*/
if (nofile > 1024) {
if (verbose) {
LOGI("setting NOFILE to %d", nofile);
}
set_nofile(nofile);
}
#endif #endif
} }
@ -1204,6 +1194,19 @@ int main(int argc, char **argv)
timeout = "60"; timeout = "60";
} }
#ifdef HAVE_SETRLIMIT
/*
* no need to check the return value here since we will show
* the user an error message if setrlimit(2) fails
*/
if (nofile > 1024) {
if (verbose) {
LOGI("setting NOFILE to %d", nofile);
}
set_nofile(nofile);
}
#endif
if (local_addr == NULL) { if (local_addr == NULL) {
local_addr = "127.0.0.1"; local_addr = "127.0.0.1";
} }

23
src/redir.c

@ -844,16 +844,6 @@ int main(int argc, char **argv)
if (nofile == 0) { if (nofile == 0) {
nofile = conf->nofile; nofile = conf->nofile;
} }
/*
* no need to check the return value here since we will show
* the user an error message if setrlimit(2) fails
*/
if (nofile > 1024) {
if (verbose) {
LOGI("setting NOFILE to %d", nofile);
}
set_nofile(nofile);
}
#endif #endif
} }
@ -867,6 +857,19 @@ int main(int argc, char **argv)
timeout = "60"; timeout = "60";
} }
#ifdef HAVE_SETRLIMIT
/*
* no need to check the return value here since we will show
* the user an error message if setrlimit(2) fails
*/
if (nofile > 1024) {
if (verbose) {
LOGI("setting NOFILE to %d", nofile);
}
set_nofile(nofile);
}
#endif
if (local_addr == NULL) { if (local_addr == NULL) {
local_addr = "127.0.0.1"; local_addr = "127.0.0.1";
} }

23
src/server.c

@ -1603,16 +1603,6 @@ int main(int argc, char **argv)
if (nofile == 0) { if (nofile == 0) {
nofile = conf->nofile; nofile = conf->nofile;
} }
/*
* no need to check the return value here since we will show
* the user an error message if setrlimit(2) fails
*/
if (nofile > 1024) {
if (verbose) {
LOGI("setting NOFILE to %d", nofile);
}
set_nofile(nofile);
}
#endif #endif
if (conf->nameserver != NULL) { if (conf->nameserver != NULL) {
nameservers[nameserver_num++] = conf->nameserver; nameservers[nameserver_num++] = conf->nameserver;
@ -1636,6 +1626,19 @@ int main(int argc, char **argv)
timeout = "60"; timeout = "60";
} }
#ifdef HAVE_SETRLIMIT
/*
* no need to check the return value here since we will show
* the user an error message if setrlimit(2) fails
*/
if (nofile > 1024) {
if (verbose) {
LOGI("setting NOFILE to %d", nofile);
}
set_nofile(nofile);
}
#endif
if (pid_flags) { if (pid_flags) {
USE_SYSLOG(argv[0]); USE_SYSLOG(argv[0]);
daemonize(pid_path); daemonize(pid_path);

23
src/tunnel.c

@ -890,16 +890,6 @@ int main(int argc, char **argv)
if (nofile == 0) { if (nofile == 0) {
nofile = conf->nofile; nofile = conf->nofile;
} }
/*
* no need to check the return value here since we will show
* the user an error message if setrlimit(2) fails
*/
if (nofile > 1024) {
if (verbose) {
LOGI("setting NOFILE to %d", nofile);
}
set_nofile(nofile);
}
#endif #endif
} }
@ -913,6 +903,19 @@ int main(int argc, char **argv)
timeout = "60"; timeout = "60";
} }
#ifdef HAVE_SETRLIMIT
/*
* no need to check the return value here since we will show
* the user an error message if setrlimit(2) fails
*/
if (nofile > 1024) {
if (verbose) {
LOGI("setting NOFILE to %d", nofile);
}
set_nofile(nofile);
}
#endif
if (local_addr == NULL) { if (local_addr == NULL) {
local_addr = "127.0.0.1"; local_addr = "127.0.0.1";
} }

Loading…
Cancel
Save