aboutsummaryrefslogtreecommitdiff
path: root/lib/utils_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils_cmd.c')
-rw-r--r--lib/utils_cmd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/utils_cmd.c b/lib/utils_cmd.c
index 9e214bd4..e41a9821 100644
--- a/lib/utils_cmd.c
+++ b/lib/utils_cmd.c
@@ -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));
}