Fix reversion in init when ran as root, introduced in version 5.20150731.

This commit is contained in:
Joey Hess 2015-08-19 12:36:17 -04:00
parent 1e3d7ad4e0
commit c242e248e8
4 changed files with 17 additions and 2 deletions

View file

@ -40,6 +40,7 @@ import Upgrade
import Utility.UserInfo
import Utility.FileMode
import Annex.Perms
import System.Posix.User
#endif
genDescription :: Maybe String -> Annex String
@ -141,8 +142,10 @@ probeCrippledFileSystem = do
-- Should be unable to write to the file, unless
-- running as root, but some crippled
-- filesystems ignore write bit removals.
unlessM
not <$> catchBoolIO (writeFile f "2" >> return True)
ifM ((== 0) <$> getRealUserID)
( return True
, not <$> catchBoolIO (writeFile f "2" >> return True)
)
#endif
checkCrippledFileSystem :: Annex ()