diff --git a/System/Lock/FLock.hsc b/System/Lock/FLock.hsc
--- a/System/Lock/FLock.hsc
+++ b/System/Lock/FLock.hsc
@@ -25,9 +25,12 @@
 #endif
 import System.Posix.Error          ( throwErrnoPathIfMinus1Retry_ )
 import System.Posix.IO             ( openFd
+#if MIN_VERSION_unix(2,8,0)
+                                   , OpenFileFlags(..)
+#endif
                                    , defaultFileFlags
                                    , closeFd
-                                   , OpenMode(ReadOnly, WriteOnly)
+                                   , OpenMode(ReadOnly)
                                    , dup
                                    )
 import System.Posix.Types          ( Fd(Fd) )
@@ -77,7 +80,12 @@
 -- | If no file or directory exists at the given path, a file will be created first.
 lock :: MonadIO m => FilePath -> SharedExclusive -> Block -> m Lock
 lock fp se b = liftIO $
-  do Fd fd <- openFd fp ReadOnly (Just stdFileMode) defaultFileFlags
+  do 
+#if MIN_VERSION_unix(2,8,0)
+     Fd fd <- openFd fp ReadOnly defaultFileFlags { creat = Just stdFileMode }
+#else
+     Fd fd <- openFd fp ReadOnly (Just stdFileMode) defaultFileFlags
+#endif
      throwErrnoPathIfMinus1Retry_ "flock" fp $ flock fd (operation se b)
      return (Lock fd)
 
@@ -91,4 +99,3 @@
 unlock (Lock fd) = liftIO $
   do _ <- flock fd c_LOCK_UN
      closeFd (Fd fd)
-
diff --git a/flock.cabal b/flock.cabal
--- a/flock.cabal
+++ b/flock.cabal
@@ -1,5 +1,5 @@
 Name:               flock
-Version:            0.3.2
+Version:            0.3.2.1
 License:            OtherLicense
 License-File:       COPYING
 Copyright:          Ian Lynagh, 2007
@@ -21,11 +21,11 @@
   Location:         git://github.com/hesselink/flock.git
 
 Library
-  Build-Depends:      base > 3 && < 4.15
-                    , transformers >= 0.2 && < 0.6
+  Build-Depends:      base > 3 && < 4.19
+                    , transformers >= 0.2 && < 0.7
                     , monad-control >= 0.3 && < 1.1
                     , lifted-base >= 0.1 && < 0.3
-                    , unix >= 2.5 && < 2.8
+                    , unix >= 2.5 && < 2.9
   Exposed-modules:    System.Lock.FLock
   GHC-Options:        -Wall
   Default-Language:   Haskell2010
