From f38ae92a38a66b597dbd6975219d6ddb4f52fa4f Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Mon, 18 Mar 2024 14:52:04 +0100 Subject: libutil: make AutoCloseFD a better resource add a reset() method to close the wrapped fd instead of assigning magic constants. also make the from-fd constructor explicit so you can't accidentally assign the *wrong* magic constant, or even an unrelated integer that also just happens to be an fd by pure chance. Change-Id: I51311b0f6e040240886b5103d39d1794a6acc325 --- src/build-remote/build-remote.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/build-remote') diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc index 118468477..04aade9db 100644 --- a/src/build-remote/build-remote.cc +++ b/src/build-remote/build-remote.cc @@ -126,7 +126,7 @@ static int main_build_remote(int argc, char * * argv) mkdir(currentLoad.c_str(), 0777); while (true) { - bestSlotLock = -1; + bestSlotLock.reset(); AutoCloseFD lock = openLockFile(currentLoad + "/main-lock", true); lockFile(lock.get(), ltWrite, true); @@ -229,7 +229,7 @@ static int main_build_remote(int argc, char * * argv) futimens(bestSlotLock.get(), NULL); #endif - lock = -1; + lock.reset(); try { @@ -282,7 +282,7 @@ connected: copyPaths(*store, *sshStore, store->parseStorePathSet(inputs), NoRepair, NoCheckSigs, substitute); } - uploadLock = -1; + uploadLock.reset(); auto drv = store->readDerivation(*drvPath); -- cgit v1.2.3