Skip to content

Commit 2c691f0

Browse files
committed
reapply the sysconf error check patch
1 parent b573658 commit 2c691f0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ext/standard/exec.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,24 @@
5050
#include <unistd.h>
5151
#endif
5252

53+
#if HAVE_LIMITS_H
54+
#include <limits.h>
55+
#endif
56+
5357
static int cmd_max_len;
5458

5559
/* {{{ PHP_MINIT_FUNCTION(exec) */
5660
PHP_MINIT_FUNCTION(exec)
5761
{
5862
#ifdef _SC_ARG_MAX
5963
cmd_max_len = sysconf(_SC_ARG_MAX);
64+
if (-1 == cmd_max_len) {
65+
#ifdef _POSIX_ARG_MAX
66+
cmd_max_len = _POSIX_ARG_MAX;
67+
#else
68+
cmd_max_len = 4096;
69+
#endif
70+
}
6071
#elif defined(ARG_MAX)
6172
cmd_max_len = ARG_MAX;
6273
#elif defined(PHP_WIN32)

0 commit comments

Comments
 (0)