about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build-remote/build-remote.cc4
-rw-r--r--src/libstore/pathlocks.cc4
-rw-r--r--src/libstore/pathlocks.hh6
3 files changed, 7 insertions, 7 deletions
diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc
index 1daf0b80ba70..acbd308f84e1 100644
--- a/src/build-remote/build-remote.cc
+++ b/src/build-remote/build-remote.cc
@@ -109,7 +109,7 @@ static std::vector<machine> read_conf()
 
 static string currentLoad;
 
-static int openSlotLock(const machine & m, unsigned long long slot)
+static AutoCloseFD openSlotLock(const machine & m, unsigned long long slot)
 {
     std::ostringstream fn_stream(currentLoad, std::ios_base::ate | std::ios_base::out);
     fn_stream << "/";
@@ -187,7 +187,7 @@ int main (int argc, char * * argv)
                         AutoCloseFD free;
                         unsigned long long load = 0;
                         for (unsigned long long slot = 0; slot < m.maxJobs; ++slot) {
-                            AutoCloseFD slotLock = openSlotLock(m, slot);
+                            auto slotLock = openSlotLock(m, slot);
                             if (lockFile(slotLock.get(), ltWrite, false)) {
                                 if (!free) {
                                     free = std::move(slotLock);
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;