diff options
| author | Andreas Schneider <mail@cynapses.org> | 2010-05-12 13:08:45 +0200 |
|---|---|---|
| committer | Andreas Schneider <mail@cynapses.org> | 2010-05-12 13:11:33 +0200 |
| commit | a009702cd6ae5954d666869a1861ecb7e59bc2b5 (patch) | |
| tree | dd1c80d59ae90f5997ae2ce3b4968bc16d056512 /libssh/poll.c | |
| parent | ed268e59485f3249c7c0e44add5c991e4c6769ef (diff) | |
Fixed Windows build warnings.
Diffstat (limited to 'libssh/poll.c')
| -rw-r--r-- | libssh/poll.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libssh/poll.c b/libssh/poll.c index d37d15bf..879d3647 100644 --- a/libssh/poll.c +++ b/libssh/poll.c @@ -65,7 +65,6 @@ int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) { #else /* HAVE_POLL */ -#include <sys/time.h> #include <sys/types.h> #ifdef _WIN32 @@ -73,11 +72,13 @@ int ssh_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) { #define STRICT #endif +#include <time.h> #include <winsock2.h> #else #include <sys/select.h> #include <sys/socket.h> #include <unistd.h> +#include <sys/time.h> #endif static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) { @@ -150,9 +151,15 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) { char data[64] = {0}; /* support for POLLHUP */ +#ifdef _WIN32 + if ((recv(fds[i].fd, data, 64, MSG_PEEK) == -1) && + (errno == WSAESHUTDOWN || errno == WSAECONNRESET || + errno == WSAECONNABORTED || errno == WSAENETRESET)) { +#else if ((recv(fds[i].fd, data, 64, MSG_PEEK) == -1) && (errno == ESHUTDOWN || errno == ECONNRESET || errno == ECONNABORTED || errno == ENETRESET)) { +#endif fds[i].revents |= POLLHUP; } else { fds[i].revents |= fds[i].events & (POLLIN | POLLRDNORM); |
