Skip to content

Commit 8c02735

Browse files
committed
transports: ssh: report failure initializing libssh2
We unconditionally return success when initializing libssh2, regardless of whether `libgssh2_init` signals success or an error. Fix this by checking its return code.
1 parent 9cc0ba6 commit 8c02735

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/transports/ssh.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,11 @@ int git_transport_ssh_with_paths(git_transport **out, git_remote *owner, void *p
896896
int git_transport_ssh_global_init(void)
897897
{
898898
#ifdef GIT_SSH
899+
if (libssh2_init(0) < 0) {
900+
giterr_set(GITERR_SSH, "unable to initialize libssh2");
901+
return -1;
902+
}
899903

900-
libssh2_init(0);
901904
return 0;
902905

903906
#else

0 commit comments

Comments
 (0)