mirror of
https://github.com/NixOS/nix.git
synced 2025-12-02 23:20:59 +01:00
libstore: Actually correctly call remove in case rename fails
This commit is contained in:
parent
d888846b68
commit
1cc337bb5f
1 changed files with 6 additions and 2 deletions
|
|
@ -255,8 +255,12 @@ void LocalStore::optimisePath_(
|
|||
try {
|
||||
std::filesystem::rename(tempLink, path);
|
||||
} catch (std::filesystem::filesystem_error & e) {
|
||||
std::filesystem::remove(tempLink);
|
||||
printError("unable to unlink %1%", tempLink);
|
||||
{
|
||||
std::error_code ec;
|
||||
remove(tempLink, ec); /* Clean up after ourselves. */
|
||||
if (ec)
|
||||
printError("unable to unlink %1%: %2%", tempLink, ec.message());
|
||||
}
|
||||
if (e.code() == std::errc::too_many_links) {
|
||||
/* Some filesystems generate too many links on the rename,
|
||||
rather than on the original link. (Probably it
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue