aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-08-18 22:06:59 +0200
committerAndreas Schneider <asn@cynapses.org>2010-08-25 23:12:27 +0200
commite5801287da1b83f9dbc68bae4e8a54394f23c8ec (patch)
tree01a96b9b8bd08c3168b88b5247873f4b8de4121c
parent5b9d92c36fbdab7aedc02cb17cfabce3e705ca9e (diff)
downloadlibssh-e5801287da1b83f9dbc68bae4e8a54394f23c8ec.tar.gz
libssh-e5801287da1b83f9dbc68bae4e8a54394f23c8ec.tar.xz
libssh-e5801287da1b83f9dbc68bae4e8a54394f23c8ec.zip
poll: Fixed the ssh_poll_(init/cleanup) functions.
-rw-r--r--libssh/poll.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libssh/poll.c b/libssh/poll.c
index ab18be72..537eb955 100644
--- a/libssh/poll.c
+++ b/libssh/poll.c
@@ -241,6 +241,8 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
}
void ssh_poll_init(void) {
+ ssh_poll_emu = bsd_poll;
+
#ifdef _WIN32
hlib = LoadLibrary(WS2_LIBRARY);
if (hlib != NULL) {
@@ -248,20 +250,20 @@ void ssh_poll_init(void) {
}
#endif /* _WIN32 */
- if (wsa_poll == NULL) {
+ if (wsa_poll != NULL) {
ssh_poll_emu = bsd_poll;
- } else {
- ssh_poll_emu = win_poll;
}
}
void ssh_poll_cleanup(void) {
ssh_poll_emu = bsd_poll;
+#ifdef _WIN32
wsa_poll = NULL;
FreeLibrary(hlib);
hlib = NULL;
+#endif /* _WIN32 */
}
int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {