diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-11-13 00:37:21 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-11-13 08:06:17 +0100 |
commit | 743efe7f525dfdde57fddfb6874de44aea8fb6ca (patch) | |
tree | 57e6aad2fc4ab4b460502978e89335051b01f09b | |
parent | 760e854348196d0c62afc7a5b023c62eced45b92 (diff) | |
download | curl-743efe7f525dfdde57fddfb6874de44aea8fb6ca.tar.gz |
single_transfer: only warn if not finding the home dirbagder/curl-survive-wo-home
... as there should be no reason to error out completely.
Reported-by: Andreas Fischer
Fixes #6200
-rw-r--r-- | src/tool_operate.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c index bc9dc058b..eb0a8264c 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -1711,30 +1711,26 @@ static CURLcode single_transfer(struct GlobalConfig *global, if(config->path_as_is) my_setopt(curl, CURLOPT_PATH_AS_IS, 1L); - if(built_in_protos & (CURLPROTO_SCP|CURLPROTO_SFTP)) { - if(!config->insecure_ok) { - char *home; - char *file; - result = CURLE_FAILED_INIT; - home = homedir(NULL); - if(home) { - file = aprintf("%s/.ssh/known_hosts", home); - if(file) { - /* new in curl 7.19.6 */ - result = res_setopt_str(curl, CURLOPT_SSH_KNOWNHOSTS, file); - curl_free(file); - if(result == CURLE_UNKNOWN_OPTION) - /* libssh2 version older than 1.1.1 */ - result = CURLE_OK; - } - Curl_safefree(home); - } - else { - errorf(global, "Failed to figure out user's home dir!"); + if((built_in_protos & (CURLPROTO_SCP|CURLPROTO_SFTP)) && + !config->insecure_ok) { + char *home; + char *file; + result = CURLE_FAILED_INIT; + home = homedir(NULL); + if(home) { + file = aprintf("%s/.ssh/known_hosts", home); + if(file) { + /* new in curl 7.19.6 */ + result = res_setopt_str(curl, CURLOPT_SSH_KNOWNHOSTS, file); + curl_free(file); + if(result == CURLE_UNKNOWN_OPTION) + /* libssh2 version older than 1.1.1 */ + result = CURLE_OK; } - if(result) - break; + Curl_safefree(home); } + else + warnf(global, "No home dir, couldn't find known_hosts file!"); } if(config->no_body || config->remote_time) { |