aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2015-11-17 11:37:24 +0100
committerHans Nilsson <[email protected]>2015-11-17 11:37:24 +0100
commitf41085bfef935a4968a94aa593592c606c23d010 (patch)
tree21723a0b8b2bec6ddfbfbe2b1d5e93a6d218c55d /lib/ssh/src
parent732457ffdd48d7d76a112d46ecb7b75c38c1065b (diff)
parentae6cec13757195406c65c598ddd9b979a2c4f517 (diff)
downloadotp-f41085bfef935a4968a94aa593592c606c23d010.tar.gz
otp-f41085bfef935a4968a94aa593592c606c23d010.tar.bz2
otp-f41085bfef935a4968a94aa593592c606c23d010.zip
Merge branch 'hans/ssh/sshdir_search_order/OTP-13109' into maint
* hans/ssh/sshdir_search_order/OTP-13109: ssh: ssh_file:default_user_dir/0 - try HOME env var first
Diffstat (limited to 'lib/ssh/src')
-rw-r--r--lib/ssh/src/ssh_file.erl14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_file.erl b/lib/ssh/src/ssh_file.erl
index 2f16a31cba..3e066c453d 100644
--- a/lib/ssh/src/ssh_file.erl
+++ b/lib/ssh/src/ssh_file.erl
@@ -336,8 +336,18 @@ is_auth_key(Key, Key) ->
is_auth_key(_,_) ->
false.
-default_user_dir()->
- {ok,[[Home|_]]} = init:get_argument(home),
+
+default_user_dir() ->
+ try
+ default_user_dir(os:getenv("HOME"))
+ catch
+ _:_ ->
+ default_user_dir(init:get_argument(home))
+ end.
+
+default_user_dir({ok,[[Home|_]]}) ->
+ default_user_dir(Home);
+default_user_dir(Home) when is_list(Home) ->
UserDir = filename:join(Home, ".ssh"),
ok = filelib:ensure_dir(filename:join(UserDir, "dummy")),
{ok,Info} = file:read_file_info(UserDir),