Refine nofile option

This commit is contained in:
Max Lv
2015-12-14 19:31:12 +08:00
parent 72ea070b1d
commit 47f984e61c
5 changed files with 62 additions and 8 deletions
+5 -2
View File
@@ -1297,7 +1297,7 @@ int main(int argc, char **argv)
USE_TTY();
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:c:i:d:a:uUvAw",
while ((c = getopt_long(argc, argv, "f:s:p:l:k:t:m:c:i:d:a:n:uUvAw",
long_options, &option_index)) != -1)
switch (c) {
case 0:
@@ -1346,6 +1346,9 @@ int main(int argc, char **argv)
case 'a':
user = optarg;
break;
case 'n':
nofile = atoi(optarg);
break;
case 'u':
mode = TCP_AND_UDP;
break;
@@ -1411,7 +1414,7 @@ int main(int argc, char **argv)
* no need to check the return value here since we will show
* the user an error message if setrlimit(2) fails
*/
if (nofile) {
if (nofile > 1024) {
if (verbose) {
LOGI("setting NOFILE to %d", nofile);
}