1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 15:48:00 +02:00

openLockFile: Return an AutoCloseFD

This commit is contained in:
Eelco Dolstra 2017-01-25 12:51:35 +01:00
parent c0f2f4eeef
commit a55f589720
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 7 additions and 7 deletions

View file

@ -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);