about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoel Taylor <me@joelt.io>2014-08-21T21·06-0700
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-21T21·17+0200
commitb224ac15201c57b40ea855f5a98b1bd166c1c7f6 (patch)
tree936f18ffddf8e92ee50359427159e8c5533430a2
parent3f80060500bb3a9dff192c11af63da7364673ab0 (diff)
fix disappearing bash arguments
-rw-r--r--src/libstore/build.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index b64c32d103db..c547a5cbfecf 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -2133,8 +2133,13 @@ void DerivationGoal::initChild()
         /* Fill in the arguments. */
         string builderBasename = baseNameOf(drv.builder);
         args.push_back(builderBasename.c_str());
-        foreach (Strings::iterator, i, drv.args)
-            args.push_back(rewriteHashes(*i, rewritesToTmp).c_str());
+        foreach (Strings::iterator, i, drv.args) {
+            auto re = rewriteHashes(*i, rewritesToTmp);
+            auto cstr = new char[re.length()+1];
+            std::strcpy(cstr, re.c_str());
+
+            args.push_back(cstr);
+        }
         args.push_back(0);
 
         restoreSIGPIPE();