From 4e1b8701573698f56e12672e4991d7e6239138d2 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 2 Feb 2016 14:26:58 +0100 Subject: reapply the sysconf error check patch --- ext/standard/exec.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ext/standard/exec.c') diff --git a/ext/standard/exec.c b/ext/standard/exec.c index cbaaedbc83..a73d0b4e6e 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -50,6 +50,10 @@ #include #endif +#if HAVE_LIMITS_H +#include +#endif + static int cmd_max_len; /* {{{ PHP_MINIT_FUNCTION(exec) */ @@ -57,6 +61,13 @@ PHP_MINIT_FUNCTION(exec) { #ifdef _SC_ARG_MAX cmd_max_len = sysconf(_SC_ARG_MAX); + if (-1 == cmd_max_len) { +#ifdef _POSIX_ARG_MAX + cmd_max_len = _POSIX_ARG_MAX; +#else + cmd_max_len = 4096; +#endif + } #elif defined(ARG_MAX) cmd_max_len = ARG_MAX; #elif defined(PHP_WIN32) -- cgit v1.2.1