aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-06-17 11:44:21 +0200
committerFredrik Gustafsson <[email protected]>2013-06-17 11:44:21 +0200
commitff493411aaf7c7b2cbf1006e0595596528f45da7 (patch)
tree0542ec51310b85e743376b5fb9cf01f6ae9f84f4 /lib/ssh
parenta568634652396b0657e089100047f127804c970d (diff)
downloadotp-ff493411aaf7c7b2cbf1006e0595596528f45da7.tar.gz
otp-ff493411aaf7c7b2cbf1006e0595596528f45da7.tar.bz2
otp-ff493411aaf7c7b2cbf1006e0595596528f45da7.zip
ssh: Not run chmod every lookup
Diffstat (limited to 'lib/ssh')
-rw-r--r--lib/ssh/src/ssh_file.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/ssh/src/ssh_file.erl b/lib/ssh/src/ssh_file.erl
index f115a32710..21cdedc156 100644
--- a/lib/ssh/src/ssh_file.erl
+++ b/lib/ssh/src/ssh_file.erl
@@ -315,5 +315,12 @@ default_user_dir()->
{ok,[[Home|_]]} = init:get_argument(home),
UserDir = filename:join(Home, ".ssh"),
ok = filelib:ensure_dir(filename:join(UserDir, "dummy")),
- ok = file:change_mode(UserDir, ?PERM_700),
+ {ok,Info} = file:read_file_info(UserDir),
+ #file_info{mode=Mode} = Info,
+ case (Mode band 8#777) of
+ ?PERM_700 ->
+ ok;
+ _Other ->
+ ok = file:change_mode(UserDir, ?PERM_700)
+ end,
UserDir.