aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-06-24 09:16:58 +0200
committerAndreas Schneider <asn@cynapses.org>2010-06-24 09:19:26 +0200
commitfc625b8a8ea32a180b6d96b69c2362bfebe51afa (patch)
tree957905781c3c4d8c3ada8a5ebf3e144c07954c14
parent703f125882caa8ead59473a9f31294fbe16a2667 (diff)
downloadlibssh-fc625b8a8ea32a180b6d96b69c2362bfebe51afa.tar.gz
libssh-fc625b8a8ea32a180b6d96b69c2362bfebe51afa.tar.xz
libssh-fc625b8a8ea32a180b6d96b69c2362bfebe51afa.zip
poll: Fixed building with poll-emulation on UNIX.
-rw-r--r--libssh/poll.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/libssh/poll.c b/libssh/poll.c
index 6f187e5..24bc56f 100644
--- a/libssh/poll.c
+++ b/libssh/poll.c
@@ -96,27 +96,27 @@ int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
#include <sys/types.h>
+typedef int (*poll_fn)(ssh_pollfd_t *, nfds_t, int);
+static poll_fn win_poll;
+
#ifdef _WIN32
#ifndef STRICT
#define STRICT
-#endif
+#endif /* STRICT */
#include <time.h>
#include <windows.h>
#include <winsock2.h>
#define WS2_LIBRARY "ws2_32.dll"
-typedef int (*poll_fn)(ssh_pollfd_t *, nfds_t, int);
-
-static poll_fn win_poll;
static HINSTANCE hlib;
-#else
+#else /* _WIN32 */
#include <sys/select.h>
#include <sys/socket.h>
#include <unistd.h>
#include <sys/time.h>
-#endif
+#endif /* _WIN32 */
/*
@@ -239,10 +239,12 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
void ssh_poll_init(void) {
poll_fn wsa_poll = NULL;
+#ifdef _WIN32
hlib = LoadLibrary(WS2_LIBRARY);
if (hlib != NULL) {
wsa_poll = (poll_fn) GetProcAddress(hlib, "WSAPoll");
}
+#endif /* _WIN32 */
if (wsa_poll == NULL) {
win_poll = bsd_poll;