Created
February 2, 2016 10:23
-
-
Save weltling/231b26fc76ab79f546c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ext/standard/exec.c b/ext/standard/exec.c | |
index 461bef4..d15c8a0 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment