summaryrefslogtreecommitdiff
path: root/Annex/Content.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-08-20 17:03:04 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-08-20 17:03:04 -0400
commit7165e4035e9b6cfeaa5d659341749cc957b27e14 (patch)
treed78cfbd2483336adb49e82de82efe27c3fc53e7d /Annex/Content.hs
parent679d9c0027ac996eea9f41a6f0f39af436801e89 (diff)
more lock file refactoring
Diffstat (limited to 'Annex/Content.hs')
-rw-r--r--Annex/Content.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 31a4444af..25c291ed1 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -101,18 +101,16 @@ inAnnexSafe key = inAnnex' (fromMaybe False) (Just False) go key
=<< contentLockFile key
#ifndef mingw32_HOST_OS
- checkindirect f = liftIO $ openforlock f >>= check is_missing
+ checkindirect f = liftIO $ openExistingLockFile f >>= check is_missing
{- In direct mode, the content file must exist, but
- the lock file often generally won't exist unless a removal is in
- process. This does not create the lock file, it only checks for
- it. -}
checkdirect contentfile lockfile = liftIO $
ifM (doesFileExist contentfile)
- ( openforlock lockfile >>= check is_unlocked
+ ( openExistingLockFile lockfile >>= check is_unlocked
, return is_missing
)
- openforlock f = catchMaybeIO $
- openFd f ReadOnly Nothing defaultFileFlags
check _ (Just h) = do
v <- getLock h (ReadLock, AbsoluteSeek, 0, 0)
closeFd h
@@ -180,7 +178,7 @@ lockContent key a = do
opencontentforlock f = catchMaybeIO $ ifM (doesFileExist f)
( withModifiedFileMode f
(`unionFileModes` ownerWriteMode)
- (createLockFie Nothing f)
+ (createLockFile Nothing f)
, createLockFile Nothing f
)
dolock Nothing = return Nothing