aboutsummaryrefslogtreecommitdiff
path: root/lib/vssh/libssh2.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-08-16 16:16:33 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-08-17 16:57:55 +0200
commitd6dea75af7c00e396cffa2e74350352703312180 (patch)
treebd1f2dd454929bf9aa6e62b3d286b631ed75f208 /lib/vssh/libssh2.c
parent5b2d703fe5900fcda846e41d67c62f62dd755839 (diff)
vssh: move ssh init/cleanup functions into backend code
Diffstat (limited to 'lib/vssh/libssh2.c')
-rw-r--r--lib/vssh/libssh2.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c
index 5dd6ee29e..011f1ecf3 100644
--- a/lib/vssh/libssh2.c
+++ b/lib/vssh/libssh2.c
@@ -3320,4 +3320,23 @@ static const char *sftp_libssh2_strerror(int err)
return "Unknown error in libssh2";
}
+CURLcode Curl_ssh_init(void)
+{
+#ifdef HAVE_LIBSSH2_INIT
+ if(libssh2_init(0)) {
+ DEBUGF(fprintf(stderr, "Error: libssh2_init failed\n"));
+ return CURLE_FAILED_INIT;
+ }
+#endif
+ return CURLE_OK;
+}
+
+void Curl_ssh_cleanup(void)
+{
+#ifdef HAVE_LIBSSH2_EXIT
+ (void)libssh2_exit();
+#endif
+}
+
+
#endif /* USE_LIBSSH2 */