From cb6cb61ca10959d6101a029ced806fe4c9cdaba5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 27 Mar 2023 12:20:35 -0400 Subject: [PATCH] avoid build warning on windows --- Annex/Content.hs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Annex/Content.hs b/Annex/Content.hs index 568077cabc..f1b147fddb 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -204,19 +204,24 @@ lockContentUsing contentlocker key fallback a = withContentLockFile key $ \mlock alreadylocked = giveup "content is locked" failedtolock e = giveup $ "failed to lock content: " ++ show e - lock locker mlockfile = tryIO $ locker >>= \case - Nothing -> alreadylocked - Just h -> #ifndef mingw32_HOST_OS - case mlockfile of - Nothing -> return h - Just lockfile -> - ifM (checkSaneLock lockfile h) - ( return h - , alreadylocked - ) + lock locker mlockfile = #else - return h + lock locker _mlockfile = +#endif + tryIO $ locker >>= \case + Nothing -> alreadylocked + Just h -> +#ifndef mingw32_HOST_OS + case mlockfile of + Nothing -> return h + Just lockfile -> + ifM (checkSaneLock lockfile h) + ( return h + , alreadylocked + ) +#else + return h #endif go (Right _) = a