Map Win32 errno values

This commit is contained in:
Sara Golemon 2006-04-17 02:49:44 +00:00
parent 19cad102f4
commit 09b93e4bb6
2 changed files with 7 additions and 5 deletions

View File

@ -640,9 +640,9 @@ static int libssh2_blocking_read(LIBSSH2_SESSION *session, unsigned char *buf, s
#ifdef WIN32
switch (WSAGetLastError()) {
case WSAEWOULDBLOCK: errno = EAGAIN; break;
case WSAENOTSOCK: errno = EBADF; break;
case WSAENOTCONN:
case WSAENOTSOCK:
case WSAECONNABORTED: errno = EBADF; break;
case WSAECONNABORTED: errno = ENOTCONN; break;
case WSAEINTR: errno = EINTR; break;
}
#endif
@ -680,7 +680,7 @@ static int libssh2_blocking_read(LIBSSH2_SESSION *session, unsigned char *buf, s
if (errno == EINTR) {
continue;
}
if ((errno == EBADF) || (errno == EIO)) {
if ((errno == EBADF) || (errno == EIO) || (errno == ENOTCONN)) {
session->socket_state = LIBSSH2_SOCKET_DISCONNECTED;
}
return -1;

View File

@ -109,11 +109,13 @@ static int libssh2_banner_receive(LIBSSH2_SESSION *session)
case WSAEWOULDBLOCK:
errno = EAGAIN;
break;
case WSAENOTCONN:
case WSAENOTSOCK:
case WSAECONNABORTED:
errno = EBADF;
break;
case WSAENOTCONN:
case WSAECONNABORTED:
errno = ENOTCONN;
break;
case WSAEINTR:
errno = EINTR;
break;