* fhandler_socket.cc (fhandler_socket::recvfrom): Return buffer

length and don't set errno in case of WSAEMSGSIZE error.
	(fhandler_socket::recvmsg): Ditto.
This commit is contained in:
Corinna Vinschen 2003-02-03 15:34:52 +00:00
parent 46c1de5bf7
commit f0f3ea68f3
2 changed files with 18 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2003-02-03 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::recvfrom): Return buffer
length and don't set errno in case of WSAEMSGSIZE error.
(fhandler_socket::recvmsg): Ditto.
2003-02-01 Christopher Faylor <cgf@redhat.com> 2003-02-01 Christopher Faylor <cgf@redhat.com>
* grp.cc (getgrent32): Only refresh group entries when at beginning. * grp.cc (getgrent32): Only refresh group entries when at beginning.

View File

@ -711,6 +711,11 @@ fhandler_socket::recvfrom (void *ptr, size_t len, int flags,
if (res == SOCKET_ERROR) if (res == SOCKET_ERROR)
{ {
/* According to SUSv3, errno isn't set in that case and no error
condition is returned. */
if (WSAGetLastError () == WSAEMSGSIZE)
return len;
res = -1; res = -1;
set_winsock_errno (); set_winsock_errno ();
} }
@ -789,6 +794,7 @@ fhandler_socket::recvmsg (struct msghdr *msg, int flags, ssize_t tot)
else else
{ {
WSABUF wsabuf[iovcnt]; WSABUF wsabuf[iovcnt];
unsigned long len = 0L;
{ {
const struct iovec *iovptr = iov + iovcnt; const struct iovec *iovptr = iov + iovcnt;
@ -797,7 +803,7 @@ fhandler_socket::recvmsg (struct msghdr *msg, int flags, ssize_t tot)
{ {
iovptr -= 1; iovptr -= 1;
wsaptr -= 1; wsaptr -= 1;
wsaptr->len = iovptr->iov_len; len += wsaptr->len = iovptr->iov_len;
wsaptr->buf = (char *) iovptr->iov_base; wsaptr->buf = (char *) iovptr->iov_base;
} }
while (wsaptr != wsabuf); while (wsaptr != wsabuf);
@ -824,6 +830,11 @@ fhandler_socket::recvmsg (struct msghdr *msg, int flags, ssize_t tot)
if (res == SOCKET_ERROR) if (res == SOCKET_ERROR)
{ {
/* According to SUSv3, errno isn't set in that case and no error
condition is returned. */
if (WSAGetLastError () == WSAEMSGSIZE)
return len;
res = -1; res = -1;
set_winsock_errno (); set_winsock_errno ();
} }