summaryrefslogtreecommitdiff
path: root/Utility/Kqueue.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-17 16:29:49 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-17 16:29:49 -0400
commit30ac6d7be04d677cdc4a1da6d60622657665083f (patch)
tree8a4099b4408d8dcbb4a5054bc6e3d3802764acd3 /Utility/Kqueue.hs
parent7d89cf0eb9aeffff25dc1b7db129c47c9f434078 (diff)
robustness fix
Don't fall over symlinks, and avoid crashing if the file goes away.
Diffstat (limited to 'Utility/Kqueue.hs')
-rw-r--r--Utility/Kqueue.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Utility/Kqueue.hs b/Utility/Kqueue.hs
index b475de3a3..62b06a532 100644
--- a/Utility/Kqueue.hs
+++ b/Utility/Kqueue.hs
@@ -69,10 +69,10 @@ data DirInfo = DirInfo
getDirInfo :: FilePath -> IO DirInfo
getDirInfo dir = do
l <- filter (not . dirCruft) <$> getDirectoryContents dir
- contents <- S.fromList <$> mapM addinode l
+ contents <- S.fromList . catMaybes <$> mapM addinode l
return $ DirInfo dir contents
where
- addinode f = do
+ addinode f = catchMaybeIO $ do
inode <- fileID <$> getFileStatus (dir </> f)
return (f, inode)