SSH: init and cleanup libssh2 in global_init/cleanup

The necessary libssh2 functions require libssh2 1.2.5 or later.
This commit is contained in:
Daniel Stenberg
2010-04-26 00:36:25 +02:00
parent 79dc74e84d
commit 107146676e
2 changed files with 16 additions and 0 deletions

View File

@@ -287,6 +287,13 @@ CURLcode curl_global_init(long flags)
}
#endif
#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_INIT)
if(libssh2_init(0)) {
DEBUGF(fprintf(stderr, "Error: libssh2_init failed\n"));
return CURLE_FAILED_INIT;
}
#endif
init_flags = flags;
/* Preset pseudo-random number sequence. */
@@ -355,6 +362,10 @@ void curl_global_cleanup(void)
amiga_cleanup();
#endif
#if defined(USE_LIBSSH2) && defined(HAVE_LIBSSH2_EXIT)
(void)libssh2_exit();
#endif
init_flags = 0;
}