* In the garbage collector, if deleting a path fails, try to fix its

ownership, then try again.
This commit is contained in:
Eelco Dolstra 2006-12-07 15:54:52 +00:00
parent a0a43c3206
commit ec23ecc64d
3 changed files with 31 additions and 6 deletions

View file

@ -710,7 +710,18 @@ void deleteFromStore(const Path & _path, unsigned long long & bytesFreed)
}
txn.commit();
deletePath(path, bytesFreed);
try {
/* First try to delete it ourselves. */
deletePath(path, bytesFreed);
} catch (SysError & e) {
/* If this failed due to a permission error, then try it with
the setuid helper. */
if (haveBuildUsers() && !amPrivileged()) {
getOwnership(path);
deletePath(path, bytesFreed);
} else
throw;
}
}