diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-17T09·24+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-07-17T09·24+0200 |
commit | 7c9d0a596961bbb74b5b2c29cc3d8f2608e45d83 (patch) | |
tree | 0bdaa86df087becc3da5fca2d28f1cccad8585db /src | |
parent | 5845ffdf1354d2acfd4a840dcfd9556742880176 (diff) |
nix-collect-garbage: Handle ENOENT
Don't barf trying to read a link that just got deleted. Fixes #575.
Diffstat (limited to 'src')
-rw-r--r-- | src/nix-collect-garbage/nix-collect-garbage.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nix-collect-garbage/nix-collect-garbage.cc b/src/nix-collect-garbage/nix-collect-garbage.cc index c8dc9099ca09..253c0b53755b 100644 --- a/src/nix-collect-garbage/nix-collect-garbage.cc +++ b/src/nix-collect-garbage/nix-collect-garbage.cc @@ -28,7 +28,12 @@ void removeOldGenerations(std::string dir) auto type = i.type == DT_UNKNOWN ? getFileType(path) : i.type; if (type == DT_LNK && canWrite) { - auto link = readLink(path); + std::string link; + try { + link = readLink(path); + } catch (SysError & e) { + if (e.errNo == ENOENT) continue; + } if (link.find("link") != string::npos) { printMsg(lvlInfo, format("removing old generations of profile %1%") % path); if (deleteOlderThan != "") |