com php-src: add error check to sysconf call: ext/standard/exec.c
| From: | Ferenc Kovacs | Date: | Wed, 03 Feb 2016 00:29:57 +0000 |
| Subject: | com php-src: add error check to sysconf call: ext/standard/exec.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90921@lists.php.net to get a copy of this message | ||
Commit: a7470a28cbc166d445fb2e56d0f8f40bc4c8b6d2
Author: Anatol Belski <ab@php.net> Tue, 2 Feb 2016 14:19:10 +0100
Committer: Ferenc Kovacs <tyrael@php.net> Wed, 3 Feb 2016 01:29:57 +0100
Parents: 0945cfe94477517df3c9c6e6a618b99cde56269f
Branches: PHP-5.6.18
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a7470a28cbc166d445fb2e56d0f8f40bc4c8b6d2
Log:
add error check to sysconf call
Changed paths:
M ext/standard/exec.c
Diff:
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index 59b979c..3884439 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)