[commit: packages/directory] master: `setPermissions`: Wrap unchecked `stat(2)` in `throwErrnoIfMinus1_` (cdc415a)

git at git.haskell.org git at git.haskell.org
Sun Oct 13 16:05:45 UTC 2013


Repository : ssh://git@git.haskell.org/directory

On branch  : master
Link       : http://git.haskell.org/packages/directory.git/commitdiff/cdc415a1fb1b46b2e49ff60fc84b32b428ff8ee9

>---------------------------------------------------------------

commit cdc415a1fb1b46b2e49ff60fc84b32b428ff8ee9
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sun Oct 13 17:23:03 2013 +0200

    `setPermissions`: Wrap unchecked `stat(2)` in `throwErrnoIfMinus1_`
    
    This affects a `mingw32_HOST_OS`-specific code section and caught my
    attention when enabling `-Wall` in a MinGW build.
    
    Signed-off-by: Herbert Valerio Riedel <hvr at gnu.org>


>---------------------------------------------------------------

cdc415a1fb1b46b2e49ff60fc84b32b428ff8ee9
 System/Directory.hs |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/System/Directory.hs b/System/Directory.hs
index 958c456..bf768db 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -252,8 +252,10 @@ setPermissions name (Permissions r w e s) = do
 #ifdef mingw32_HOST_OS
   allocaBytes sizeof_stat $ \ p_stat -> do
   withFilePath name $ \p_name -> do
-    throwErrnoIfMinus1_ "setPermissions" $ do
+    throwErrnoIfMinus1_ "setPermissions" $
       c_stat p_name p_stat
+
+    throwErrnoIfMinus1_ "setPermissions" $ do
       mode <- st_mode p_stat
       let mode1 = modifyBit r mode s_IRUSR
       let mode2 = modifyBit w mode1 s_IWUSR



More information about the ghc-commits mailing list