From 7874a2d84d7229f76cfb94efb66fb1869aa79bb8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 7 Feb 2014 14:57:23 -0400 Subject: Android: Avoid crashing when unable to set file mode for ssh config file due to Android filesystem horribleness. --- Utility/SshConfig.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Utility/SshConfig.hs') 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 -- cgit v1.2.3