Updated Branches:
  refs/heads/master b9e6ce6e9 -> d8da5f4d1

Fixed ARG_MAX compilation issue on some POSIX systems.


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d8da5f4d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d8da5f4d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d8da5f4d

Branch: refs/heads/master
Commit: d8da5f4d17d3a673beb5b76d0a7370bdda99c51d
Parents: b9e6ce6
Author: Benjamin Mahler <bmah...@twitter.com>
Authored: Wed Oct 2 15:39:28 2013 -0700
Committer: Benjamin Mahler <bmah...@twitter.com>
Committed: Wed Oct 2 15:39:28 2013 -0700

----------------------------------------------------------------------
 src/tests/script.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d8da5f4d/src/tests/script.cpp
----------------------------------------------------------------------
diff --git a/src/tests/script.cpp b/src/tests/script.cpp
index 847e6c5..b4aef6b 100644
--- a/src/tests/script.cpp
+++ b/src/tests/script.cpp
@@ -16,10 +16,10 @@
  * limitations under the License.
  */
 
-#include <limits.h> // For ARG_MAX.
 #include <signal.h> // For strsignal.
 #include <stdio.h>  // For freopen.
 #include <string.h> // For strlen, strerror.
+#include <unistd.h> // For sysconf.
 
 #include <sys/wait.h> // For wait (and associated macros).
 
@@ -44,7 +44,10 @@ namespace tests {
 
 void execute(const string& script, const vector<string>& arguments)
 {
-  CHECK_LT(arguments.size(), static_cast<size_t>(ARG_MAX));
+  static long maximumArguments = sysconf(_SC_ARG_MAX);
+  PCHECK(maximumArguments != -1);
+
+  CHECK_LT(arguments.size(), static_cast<size_t>(maximumArguments));
 
   // Create a temporary directory for the test.
   Try<string> directory = environment->mkdtemp();

Reply via email to