mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Handle RLIM_INFINITY as socket limit.
This commit is contained in:
@@ -4722,7 +4722,7 @@ int set_max_open_descriptors(int desired_max) {
|
||||
|
||||
if (!getrlimit(flag, &r)) {
|
||||
/* If current limit is less than the desired, try to increase it */
|
||||
if(r.rlim_cur < (rlim_t)desired_max){
|
||||
if(r.rlim_cur != RLIM_INFINITY && r.rlim_cur < (rlim_t)desired_max){
|
||||
if(desired_max<0){
|
||||
r.rlim_cur=r.rlim_max; /* Set maximum */
|
||||
}else{
|
||||
@@ -4732,6 +4732,7 @@ int set_max_open_descriptors(int desired_max) {
|
||||
; // netutil_debug("setrlimit(%d, %p) failed", flag, r);
|
||||
if (!getrlimit(flag, &r)) {
|
||||
maxfds = r.rlim_cur;
|
||||
// NOTE: This may be RLIM_INFINITY, which is -1 (~0UL) on Linux.
|
||||
return maxfds;
|
||||
}else {
|
||||
return 0;
|
||||
|
||||
4
nmap.cc
4
nmap.cc
@@ -1994,8 +1994,8 @@ int nmap_main(int argc, char *argv[]) {
|
||||
SIGPIPE */
|
||||
#endif
|
||||
|
||||
if (o.max_parallelism && (i = max_sd()) && i < o.max_parallelism) {
|
||||
error("WARNING: Your specified max_parallel_sockets of %d, but your system says it might only give us %d. Trying anyway", o.max_parallelism, i);
|
||||
if (o.max_parallelism && (i = max_sd()) > 0 && i < o.max_parallelism) {
|
||||
error("WARNING: max_parallelism is %d, but your system says it might only give us %d sockets. Trying anyway", o.max_parallelism, i);
|
||||
}
|
||||
|
||||
if (o.debugging > 1)
|
||||
|
||||
Reference in New Issue
Block a user