Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
load_known_hosts: do not fail if homedir is invalid
  • Loading branch information
JonasVautherin committed Mar 27, 2025
commit faeeffdaaaa5db7d9330b6965bdc32e9a66e648e
4 changes: 2 additions & 2 deletions src/libgit2/transports/ssh_libssh2.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ static int load_known_hosts(LIBSSH2_KNOWNHOSTS **hosts, LIBSSH2_SESSION *session

GIT_ASSERT_ARG(hosts);

if ((error = git_sysdir_expand_homedir_file(&sshdir, SSH_DIR)) < 0 ||
(error = git_str_joinpath(&path, git_str_cstr(&sshdir), KNOWN_HOSTS_FILE)) < 0)
git_sysdir_expand_homedir_file(&sshdir, SSH_DIR);
if ((error = git_str_joinpath(&path, git_str_cstr(&sshdir), KNOWN_HOSTS_FILE)) < 0)
goto out;

if ((known_hosts = libssh2_knownhost_init(session)) == NULL) {
Expand Down