From f1a6e00a3107317d551c27459194aff3317919f4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 30 Mar 2017 19:32:58 -0400 Subject: multicast: New command, uses uftp to multicast annexed files, for eg a classroom setting. This commit was supported by the NSF-funded DataLad project. --- Utility/FileMode.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Utility/FileMode.hs') diff --git a/Utility/FileMode.hs b/Utility/FileMode.hs index fe9cbf56a..d9a269448 100644 --- a/Utility/FileMode.hs +++ b/Utility/FileMode.hs @@ -177,7 +177,10 @@ writeFileProtected file content = writeFileProtected' file (\h -> hPutStr h content) writeFileProtected' :: FilePath -> (Handle -> IO ()) -> IO () -writeFileProtected' file writer = withUmask 0o0077 $ +writeFileProtected' file writer = protectedOutput $ withFile file WriteMode $ \h -> do void $ tryIO $ modifyFileMode file $ removeModes otherGroupModes writer h + +protectedOutput :: IO a -> IO a +protectedOutput = withUmask 0o0077 -- cgit v1.2.3