remove hard link when sanity check failed

See http://git-annex.branchable.com/forum/dot_git_slash_annex_slash_tmp/
This commit is contained in:
Joey Hess 2012-11-29 16:46:59 -04:00
parent 76eb3d858c
commit d2df2e52b4
2 changed files with 7 additions and 1 deletions

View file

@ -213,7 +213,10 @@ handleAdds delayadd cs = returnWhen (null incomplete) $ do
ks <- liftIO $ getSymbolicLinkStatus $ contentLocation keysource
if deviceID ks == deviceID fs && fileID ks == fileID fs
then a
else return Nothing
else do
-- remove the hard link
void $ liftIO $ tryIO $ removeFile $ contentLocation keysource
return Nothing
{- Files can Either be Right to be added now,
- or are unsafe, and must be Left for later.