diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-25 13:30:32 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-25 13:33:13 -0400 |
commit | 19043fb8013180c0ac18e45129e0f20cb3ea7ff0 (patch) | |
tree | 80badf026584e6c44e7604a487475f0d70f9be11 /Command | |
parent | 198beb11348ec1485cadd3a8a576b3b68d9170ee (diff) |
move sticky bit code into Utility.FileMode
Simplified it using existing functions.
I doubt setSticky needs to return the FileMode; if it does for some
reason, it can be changed to use modifyFileMode'
Converted isSticky to a pure function for consistency with isSymlink.
Note that the sticky bit of a file can be tested thus:
isSticky . fileMode <$> getFileStatus file
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Fsck.hs | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 6f45cfabc..834ca8af6 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -27,9 +27,6 @@ import Utility.FileMode import Config import qualified Option import Types.Key -import System.Posix.Types -import System.Posix.Files -import Data.Bits def :: [Command] def = [withOptions options $ command "fsck" paramPaths seek @@ -322,20 +319,6 @@ badContentRemote remote key = do return $ (if ok then "dropped from " else "failed to drop from ") ++ Remote.name remote -isSticky :: String -> IO Bool -isSticky f = do - fs <- getFileStatus f - let mode = fileMode fs - return $ 0/= mode .&. 512 - -setSticky :: String -> IO FileMode -setSticky f = do - fs <- getFileStatus f - let mode = fileMode fs - let newmode = mode .|. 512 - setFileMode f newmode - return newmode - updateMetadata :: Key -> Annex Bool updateMetadata key = do file <- inRepo $ gitAnnexLocation key |