diff options
author | Hans Nilsson <[email protected]> | 2015-11-17 11:38:01 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2015-11-17 11:38:01 +0100 |
commit | 98550cc4ac8857a4cf6565e18fc76a14780fe60c (patch) | |
tree | 2af01992c8d60cdefc38be761df49ec502bd00e0 /lib/ssh | |
parent | c18d0917c8da1cd06f9b8f752a54ca4c5316a702 (diff) | |
parent | f41085bfef935a4968a94aa593592c606c23d010 (diff) | |
download | otp-98550cc4ac8857a4cf6565e18fc76a14780fe60c.tar.gz otp-98550cc4ac8857a4cf6565e18fc76a14780fe60c.tar.bz2 otp-98550cc4ac8857a4cf6565e18fc76a14780fe60c.zip |
Merge branch 'maint'
* maint:
ssh: ssh_file:default_user_dir/0 - try HOME env var first
Diffstat (limited to 'lib/ssh')
-rw-r--r-- | lib/ssh/src/ssh_file.erl | 14 |
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), |