aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-07-09 15:00:11 +0200
committerFredrik Gustafsson <[email protected]>2013-07-09 15:00:11 +0200
commitf0608e162193edf10d0591ff4ab3236935e0e52b (patch)
treef1af1a8989383f255fb8e405d70abc6946a846db /lib/ssh
parent2db8fc3414015bf556d58d4a1d4a4493fc746a00 (diff)
parentff493411aaf7c7b2cbf1006e0595596528f45da7 (diff)
downloadotp-f0608e162193edf10d0591ff4ab3236935e0e52b.tar.gz
otp-f0608e162193edf10d0591ff4ab3236935e0e52b.tar.bz2
otp-f0608e162193edf10d0591ff4ab3236935e0e52b.zip
Merge branch 'fredrik/ssh/chmod/OTP-11189' into maint
* fredrik/ssh/chmod/OTP-11189: 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.