diff options
author | Fredrik Gustafsson <[email protected]> | 2013-06-17 11:44:21 +0200 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2013-06-17 11:44:21 +0200 |
commit | ff493411aaf7c7b2cbf1006e0595596528f45da7 (patch) | |
tree | 0542ec51310b85e743376b5fb9cf01f6ae9f84f4 /lib/ssh | |
parent | a568634652396b0657e089100047f127804c970d (diff) | |
download | otp-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.erl | 9 |
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. |