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:08:45 +0200 |
commit | da9b2e25f6233a419495933822446adf5736cdef (patch) | |
tree | 98413d3321779b3370143f5e7a9c66db8de456f9 /libssh/poll.c | |
parent | fc508f9494080035626c38e81216314f3137de0a (diff) | |
download | libssh-da9b2e25f6233a419495933822446adf5736cdef.tar.gz libssh-da9b2e25f6233a419495933822446adf5736cdef.tar.xz libssh-da9b2e25f6233a419495933822446adf5736cdef.zip |
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 327c9b25..fb88596e 100644 --- a/libssh/poll.c +++ b/libssh/poll.c @@ -69,7 +69,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 @@ -77,11 +76,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) { @@ -154,9 +155,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); |