]> granicus.if.org Git - php/commitdiff
reapply the sysconf error check patch
authorAnatol Belski <ab@php.net>
Tue, 2 Feb 2016 13:26:58 +0000 (14:26 +0100)
committerAnatol Belski <ab@php.net>
Tue, 2 Feb 2016 13:26:58 +0000 (14:26 +0100)
ext/standard/exec.c

index cbaaedbc83d95d16994d2c6d4fce8e2e4e025ac1..a73d0b4e6e017f2a8165d207efc1c316f5ecc0e5 100644 (file)
 #include <unistd.h>
 #endif
 
+#if HAVE_LIMITS_H
+#include <limits.h>
+#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)