diff options
author | Joey Hess <joey@kitenet.net> | 2014-03-31 20:15:16 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-03-31 20:15:16 -0400 |
commit | ada150dc74a2fb13dd8c5885f346ac9ab4343531 (patch) | |
tree | 94efd4b57878db6dc1d1a5a2bd785c6526b4c940 /Utility | |
parent | 5a300196e8853064d94be391d7c1f2b9f720c5ae (diff) |
refactor
Diffstat (limited to 'Utility')
-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 |