summaryrefslogtreecommitdiff
path: root/src/Platform.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-05-12 00:55:12 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-05-12 00:55:12 +0900
commit89c1916fa57d87ea09142cc3588044c691d1928f (patch)
treeea35f4171e9e5b85e7336688b6089786a9c6701d /src/Platform.cc
parent4654f1974a5faa832518ba3875ecb3e77224e656 (diff)
parent2758fba10c79a76e07f7cfb894f5cfcbaff85ff7 (diff)
Merge branch 'sftp'
Diffstat (limited to 'src/Platform.cc')
-rw-r--r--src/Platform.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Platform.cc b/src/Platform.cc
index d93c48eb..8520440d 100644
--- a/src/Platform.cc
+++ b/src/Platform.cc
@@ -56,6 +56,10 @@
# include <ares.h>
#endif // ENABLE_ASYNC_DNS
+#ifdef HAVE_LIBSSH2
+# include <libssh2.h>
+#endif // HAVE_LIBSSH2
+
#include "a2netcompat.h"
#include "DlAbortEx.h"
#include "message.h"
@@ -149,6 +153,15 @@ bool Platform::setUp()
}
#endif // CARES_HAVE_ARES_LIBRARY_INIT
+#ifdef HAVE_LIBSSH2
+ {
+ auto rv = libssh2_init(0);
+ if (rv != 0) {
+ throw DL_ABORT_EX(fmt("libssh2_init() failed, code: %d", rv));
+ }
+ }
+#endif // HAVE_LIBSSH2
+
#ifdef HAVE_WINSOCK2_H
WSADATA wsaData;
memset(reinterpret_cast<char*>(&wsaData), 0, sizeof(wsaData));
@@ -181,6 +194,10 @@ bool Platform::tearDown()
ares_library_cleanup();
#endif // CARES_HAVE_ARES_LIBRARY_CLEANUP
+#ifdef HAVE_LIBSSH2
+ libssh2_exit();
+#endif // HAVE_LIBSSH2
+
#ifdef HAVE_WINSOCK2_H
WSACleanup();
#endif // HAVE_WINSOCK2_H