Android: Avoid crashing when unable to set file mode for ssh config file due to Android filesystem horribleness.

This commit is contained in:
Joey Hess 2014-02-07 14:57:23 -04:00
parent 590adeb2a7
commit 3cbaa68be8
3 changed files with 11 additions and 2 deletions

View file

@ -127,9 +127,13 @@ writeSshConfig f s = do
{- Ensure that the ssh config file lacks any group or other write bits,
- since ssh is paranoid about not working if other users can write
- to one of its config files (.ssh/config and .ssh/authorized_keys) -}
- to one of its config files (.ssh/config and .ssh/authorized_keys).
-
- If the chmod fails, ignore the failure, as it might be a filesystem like
- Android's that does not support file modes.
-}
setSshConfigMode :: FilePath -> IO ()
setSshConfigMode f = modifyFileMode f $
setSshConfigMode f = void $ tryIO $ modifyFileMode f $
removeModes [groupWriteMode, otherWriteMode]
sshDir :: IO FilePath