Map Win32 errno values
This commit is contained in:
parent
19cad102f4
commit
09b93e4bb6
@ -640,9 +640,9 @@ static int libssh2_blocking_read(LIBSSH2_SESSION *session, unsigned char *buf, s
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
switch (WSAGetLastError()) {
|
switch (WSAGetLastError()) {
|
||||||
case WSAEWOULDBLOCK: errno = EAGAIN; break;
|
case WSAEWOULDBLOCK: errno = EAGAIN; break;
|
||||||
|
case WSAENOTSOCK: errno = EBADF; break;
|
||||||
case WSAENOTCONN:
|
case WSAENOTCONN:
|
||||||
case WSAENOTSOCK:
|
case WSAECONNABORTED: errno = ENOTCONN; break;
|
||||||
case WSAECONNABORTED: errno = EBADF; break;
|
|
||||||
case WSAEINTR: errno = EINTR; break;
|
case WSAEINTR: errno = EINTR; break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -680,7 +680,7 @@ static int libssh2_blocking_read(LIBSSH2_SESSION *session, unsigned char *buf, s
|
|||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((errno == EBADF) || (errno == EIO)) {
|
if ((errno == EBADF) || (errno == EIO) || (errno == ENOTCONN)) {
|
||||||
session->socket_state = LIBSSH2_SOCKET_DISCONNECTED;
|
session->socket_state = LIBSSH2_SOCKET_DISCONNECTED;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -109,11 +109,13 @@ static int libssh2_banner_receive(LIBSSH2_SESSION *session)
|
|||||||
case WSAEWOULDBLOCK:
|
case WSAEWOULDBLOCK:
|
||||||
errno = EAGAIN;
|
errno = EAGAIN;
|
||||||
break;
|
break;
|
||||||
case WSAENOTCONN:
|
|
||||||
case WSAENOTSOCK:
|
case WSAENOTSOCK:
|
||||||
case WSAECONNABORTED:
|
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
break;
|
break;
|
||||||
|
case WSAENOTCONN:
|
||||||
|
case WSAECONNABORTED:
|
||||||
|
errno = ENOTCONN;
|
||||||
|
break;
|
||||||
case WSAEINTR:
|
case WSAEINTR:
|
||||||
errno = EINTR;
|
errno = EINTR;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user