mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-04-22 22:56:58 -04:00
avoid a segfault, if ulimit is set to unlimited
This commit is contained in:
parent
054bfc9922
commit
6bb5e1db52
1 changed files with 8 additions and 0 deletions
|
|
@ -116,6 +116,14 @@ cmd_init (void)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* if maxfd is unnaturally high, we force it to a lower value
|
||||
* ( e.g. on SunOS, when ulimit is set to unlimited: 2147483647 this would cause
|
||||
* a segfault when following calloc is called ... ) */
|
||||
|
||||
if ( maxfd > 2048 ) {
|
||||
maxfd = 2048;
|
||||
}
|
||||
|
||||
if (!_cmd_pids)
|
||||
_cmd_pids = calloc (maxfd, sizeof (pid_t));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue