about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-01-25T11·51+0100
committerEelco Dolstra <edolstra@gmail.com>2017-01-26T19·40+0100
commita55f589720e6499ed8ca1e3dd63ae18c52782150 (patch)
tree9bcc366d7ea1030a38d248e44efd5fb99bd8408d /src/libstore
parentc0f2f4eeeffd9c62ee2c59b42e6824d297d210f1 (diff)
openLockFile: Return an AutoCloseFD
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/pathlocks.cc4
-rw-r--r--src/libstore/pathlocks.hh6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/libstore/pathlocks.cc b/src/libstore/pathlocks.cc
index 620c9a6b752d..559737992798 100644
--- a/src/libstore/pathlocks.cc
+++ b/src/libstore/pathlocks.cc
@@ -13,7 +13,7 @@
 namespace nix {
 
 
-int openLockFile(const Path & path, bool create)
+AutoCloseFD openLockFile(const Path & path, bool create)
 {
     AutoCloseFD fd;
 
@@ -21,7 +21,7 @@ int openLockFile(const Path & path, bool create)
     if (!fd && (create || errno != ENOENT))
         throw SysError(format("opening lock file ‘%1%’") % path);
 
-    return fd.release();
+    return fd;
 }
 
 
diff --git a/src/libstore/pathlocks.hh b/src/libstore/pathlocks.hh
index 40103c393f64..2a7de611446e 100644
--- a/src/libstore/pathlocks.hh
+++ b/src/libstore/pathlocks.hh
@@ -1,6 +1,6 @@
 #pragma once
 
-#include "types.hh"
+#include "util.hh"
 
 
 namespace nix {
@@ -9,7 +9,7 @@ namespace nix {
 /* Open (possibly create) a lock file and return the file descriptor.
    -1 is returned if create is false and the lock could not be opened
    because it doesn't exist.  Any other error throws an exception. */
-int openLockFile(const Path & path, bool create);
+AutoCloseFD openLockFile(const Path & path, bool create);
 
 /* Delete an open lock file. */
 void deleteLockFile(const Path & path, int fd);
@@ -19,7 +19,7 @@ enum LockType { ltRead, ltWrite, ltNone };
 bool lockFile(int fd, LockType lockType, bool wait);
 
 
-class PathLocks 
+class PathLocks
 {
 private:
     typedef std::pair<int, Path> FDPair;