diff options
| author | Andrew Schurman <aschurma@google.com> | 2016-06-12 23:57:08 -0700 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-06-19 13:19:48 -0400 |
| commit | 6589837d4c3e7c93d13bb778fccbb1b71cfe2b51 (patch) | |
| tree | ab395fe303f278c194760f9854895a9b90ee254b /src/Utility | |
| parent | 0e3d258f46e366e01abf28e173ef8fb7adf5a6dd (diff) | |
Write privdata files in binary rather than text
https://propellor.branchable.com/todo/bytes_in_privData__63__/
Diffstat (limited to 'src/Utility')
| -rw-r--r-- | src/Utility/FileMode.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Utility/FileMode.hs b/src/Utility/FileMode.hs index bb3780c6..3068d55a 100644 --- a/src/Utility/FileMode.hs +++ b/src/Utility/FileMode.hs @@ -13,6 +13,7 @@ module Utility.FileMode ( ) where import System.IO +import qualified Data.ByteString.Lazy as L import Control.Monad import System.PosixCompat.Types import Utility.PosixFiles @@ -166,3 +167,7 @@ writeFileProtected' file writer = withUmask 0o0077 $ withFile file WriteMode $ \h -> do void $ tryIO $ modifyFileMode file $ removeModes otherGroupModes writer h + +writeBytesProtected :: FilePath -> L.ByteString -> IO () +writeBytesProtected file content = writeFileProtected' file + (`L.hPutStr` content) |
