summaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-17 17:26:53 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-17 17:26:53 -0400
commitd53f70e2039a00b2ba2b87e26f29705d8f4c629a (patch)
treefd4fcd67dc6840b444123057df6ad8e73f7b4cf9 /Logs
parentb702bae9501676082a1f9388286b3c9855d8a44a (diff)
avoid parsing lock files as transfer files
This seems to happen with kqueue, not inotify. The newly added lck file triggers an add event and was then parsed as a transfer file.
Diffstat (limited to 'Logs')
-rw-r--r--Logs/Transfer.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs
index 55db855cc..260512067 100644
--- a/Logs/Transfer.hs
+++ b/Logs/Transfer.hs
@@ -144,8 +144,9 @@ transferLockFile infofile = let (d,f) = splitFileName infofile in
{- Parses a transfer information filename to a Transfer. -}
parseTransferFile :: FilePath -> Maybe Transfer
-parseTransferFile file =
- case drop (length bits - 3) bits of
+parseTransferFile file
+ | "lck." `isPrefixOf` (takeFileName file) = Nothing
+ | otherwise = case drop (length bits - 3) bits of
[direction, u, key] -> Transfer
<$> readDirection direction
<*> pure (toUUID u)