aboutsummaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-07 14:57:23 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-07 14:57:23 -0400
commit7874a2d84d7229f76cfb94efb66fb1869aa79bb8 (patch)
treedc82aad791fc6504cdb4df03aefb2fba70f3af6e /Utility
parent8c2c836d7143f3fafd85fd710750fc21337fd331 (diff)
Android: Avoid crashing when unable to set file mode for ssh config file due to Android filesystem horribleness.
Diffstat (limited to 'Utility')
-rw-r--r--Utility/SshConfig.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Utility/SshConfig.hs b/Utility/SshConfig.hs
index d6cd32078..080f6479f 100644
--- a/Utility/SshConfig.hs
+++ b/Utility/SshConfig.hs
@@ -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