diff options
-rw-r--r-- | Utility/FileMode.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Utility/FileMode.hs b/Utility/FileMode.hs index 26692b3ba..4302f8bd1 100644 --- a/Utility/FileMode.hs +++ b/Utility/FileMode.hs @@ -58,6 +58,12 @@ readModes = [ownerReadMode, groupReadMode, otherReadMode] executeModes :: [FileMode] executeModes = [ownerExecuteMode, groupExecuteMode, otherExecuteMode] +otherGroupModes :: [FileMode] +otherGroupModes = + [ groupReadMode, otherReadMode + , groupWriteMode, otherWriteMode + ] + {- Removes the write bits from a file. -} preventWrite :: FilePath -> IO () preventWrite f = modifyFileMode f $ removeModes writeModes @@ -147,9 +153,5 @@ setSticky f = modifyFileMode f $ addModes [stickyMode] writeFileProtected :: FilePath -> String -> IO () writeFileProtected file content = withUmask 0o0077 $ withFile file WriteMode $ \h -> do - void $ tryIO $ modifyFileMode file $ - removeModes - [ groupReadMode, otherReadMode - , groupWriteMode, otherWriteMode - ] + void $ tryIO $ modifyFileMode file $ removeModes otherGroupModes hPutStr h content |