From cf72a0f7c35ee791d5b4a81ef799d006e1b16bda Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Thu, 3 Mar 2011 16:11:38 +0100 Subject: Call WSAGetLastError() everywhere errno is read after a Winsock call. Winsock does NOT update errno for us, we have fetch the last error manually using WSAGetLastError(). --- libvncserver/rfbserver.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libvncserver/rfbserver.c') diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c index 554c118..73be34c 100644 --- a/libvncserver/rfbserver.c +++ b/libvncserver/rfbserver.c @@ -1350,6 +1350,9 @@ rfbBool rfbSendFileTransferChunk(rfbClientPtr cl) n = select(cl->sock + 1, NULL, &wfds, NULL, &tv); if (n<0) { +#ifdef WIN32 + errno=WSAGetLastError(); +#endif rfbLog("rfbSendFileTransferChunk() select failed: %s\n", strerror(errno)); } /* We have space on the transmit queue */ @@ -1369,6 +1372,9 @@ rfbBool rfbSendFileTransferChunk(rfbClientPtr cl) return retval; case -1: /* TODO : send an error msg to the client... */ +#ifdef WIN32 + errno=WSAGetLastError(); +#endif rfbLog("rfbSendFileTransferChunk(): %s\n",strerror(errno)); retval = rfbSendFileTransferMessage(cl, rfbAbortFileTransfer, 0, 0, 0, NULL); close(cl->fileTransfer.fd); -- cgit v1.2.1