avoid build warning on windows
authorJoey Hess <joeyh@joeyh.name>
Mon, 27 Mar 2023 16:20:35 +0000 (12:20 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 27 Mar 2023 16:20:35 +0000 (12:20 -0400)
Annex/Content.hs

index 568077cabc50686c43e0013bd45ca2769a4438aa..f1b147fddb10babfd6dfc5fcdd0e26fceb773360 100644 (file)
@@ -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