summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-08-19 12:36:17 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-08-19 12:36:17 -0400
commit10ee24d68a077d79e479a6b46947c204ef89d08f (patch)
tree15619794574b6bb9444ea1dae63691d041e72ab4 /Annex
parent024c14574856fc6a107ee4c55a57bf6f583ca501 (diff)
Fix reversion in init when ran as root, introduced in version 5.20150731.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Init.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Annex/Init.hs b/Annex/Init.hs
index 5759adffc..e59f04572 100644
--- a/Annex/Init.hs
+++ b/Annex/Init.hs
@@ -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 ()