about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/store.cc9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/libstore/store.cc b/src/libstore/store.cc
index c83316cf6ad5..caaa293a6f1c 100644
--- a/src/libstore/store.cc
+++ b/src/libstore/store.cc
@@ -1,9 +1,6 @@
 #include <iostream>
 
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <sys/wait.h>
-#include <fcntl.h>
 #include <unistd.h>
 
 #include "store.hh"
@@ -307,11 +304,7 @@ void addTextToStore(const Path & dstPath, const string & s)
         PathLocks outputLock(lockPaths);
 
         if (!isValidPath(dstPath)) {
-
-            AutoCloseFD fd = open(dstPath.c_str(), O_CREAT | O_EXCL | O_WRONLY, 0666);
-            if (fd == -1) throw SysError(format("creating store file `%1%'") % dstPath);
-
-            writeFull(fd, (unsigned char *) s.c_str(), s.size());
+            writeStringToFile(dstPath, s);
 
             Transaction txn(nixDB);
             registerValidPath(txn, dstPath);