about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2015-12-29T22·37+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-01-05T12·26+0100
commitf770b9e6c54a0e149a45c458fd6c17eead00cf98 (patch)
tree84c6bc7786d233787a8a85950fee7e7d4cf2589a
parent71a93a5f0e742eb4856a4a5ea46b06a309bb04de (diff)
libstore: mmap() returns MAP_FAILED, not NULL on failure
-rw-r--r--src/libstore/build.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 4192c6c659eb..02faa5c9d873 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -2175,7 +2175,7 @@ void DerivationGoal::startBuilder()
             size_t stackSize = 1 * 1024 * 1024;
             char * stack = (char *) mmap(0, stackSize,
                 PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0);
-            if (!stack) throw SysError("allocating stack");
+            if (stack == MAP_FAILED) throw SysError("allocating stack");
             int flags = CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWIPC | CLONE_NEWUTS | CLONE_PARENT | SIGCHLD;
             if (!fixedOutput) flags |= CLONE_NEWNET;
             pid_t child = clone(childEntry, stack + stackSize, flags, this);