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

Address PR feedback on #6694

This commit is contained in:
Andrew Brooks 2022-09-12 11:33:23 -05:00
parent 84fe75a12a
commit 565d888e0f
2 changed files with 3 additions and 5 deletions

View file

@ -622,9 +622,8 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
/* There may be temp directories in the store that are still in use
by another process. We need to be sure that we can acquire an
exclusive lock before deleting them. */
AutoCloseFD tmpDirFd;
if (baseName.rfind("add-", 0) == 0) {
tmpDirFd = open(realPath.c_str(), O_RDONLY | O_DIRECTORY);
if (baseName.find("tmp-", 0) == 0) {
AutoCloseFD tmpDirFd = open(realPath.c_str(), O_RDONLY | O_DIRECTORY);
if (tmpDirFd.get() == -1 || !lockFile(tmpDirFd.get(), ltWrite, false)) {
debug("skipping locked tempdir '%s'", realPath);
return;