]> git.proxmox.com Git - libgit2.git/commitdiff
transports: ssh: report failure initializing libssh2
authorPatrick Steinhardt <ps@pks.im>
Tue, 2 May 2017 11:35:09 +0000 (13:35 +0200)
committerPatrick Steinhardt <ps@pks.im>
Tue, 2 May 2017 12:46:15 +0000 (14:46 +0200)
We unconditionally return success when initializing libssh2, regardless
of whether `libgssh2_init` signals success or an error. Fix this by
checking its return code.

src/transports/ssh.c

index 44d02e52298f506a97357e7d6ebee78ee7cd0276..d195d58ad0c914b78883168cc67fecd4d45a75ff 100644 (file)
@@ -896,8 +896,11 @@ int git_transport_ssh_with_paths(git_transport **out, git_remote *owner, void *p
 int git_transport_ssh_global_init(void)
 {
 #ifdef GIT_SSH
+       if (libssh2_init(0) < 0) {
+               giterr_set(GITERR_SSH, "unable to initialize libssh2");
+               return -1;
+       }
 
-       libssh2_init(0);
        return 0;
 
 #else