summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2016-02-02 14:22:31 +0100
committerAnatol Belski <ab@php.net>2016-02-02 14:22:31 +0100
commitb837f205ca5f827dfef7561e728d82642d5449a0 (patch)
treec8424649e64eb546eab619fc917e0b1372ad977f
parent43fee6c6a11e74a7d749bd47117405335e466ce0 (diff)
parent377d353c9f8aad6f79f3cf84aad3e2f6d65fa456 (diff)
downloadphp-git-b837f205ca5f827dfef7561e728d82642d5449a0.tar.gz
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: add error check to sysconf call Going for 5.5.33 now Conflicts: configure.in main/php_version.h
-rw-r--r--ext/standard/exec.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 59b979c1c1..38844393e7 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -50,6 +50,10 @@
#include <unistd.h>
#endif
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
#ifdef PHP_WIN32
# include "win32/php_stdint.h"
#else
@@ -67,6 +71,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)