diff options
-rw-r--r-- | lib/utils_cmd.c | 8 |
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) | |||
116 | } | 116 | } |
117 | #endif | 117 | #endif |
118 | 118 | ||
119 | /* if maxfd is unnaturally high, we force it to a lower value | ||
120 | * ( e.g. on SunOS, when ulimit is set to unlimited: 2147483647 this would cause | ||
121 | * a segfault when following calloc is called ... ) */ | ||
122 | |||
123 | if ( maxfd > 2048 ) { | ||
124 | maxfd = 2048; | ||
125 | } | ||
126 | |||
119 | if (!_cmd_pids) | 127 | if (!_cmd_pids) |
120 | _cmd_pids = calloc (maxfd, sizeof (pid_t)); | 128 | _cmd_pids = calloc (maxfd, sizeof (pid_t)); |
121 | } | 129 | } |