* fhandler_socket.cc (fhandler_socket::recvfrom): Always initialize

ret to 0 when using in Winsock call.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendto): Ditto.
	(fhandler_socket::sendmsg): Ditto.
This commit is contained in:
Corinna Vinschen 2004-03-31 15:33:33 +00:00
parent decd3e5d72
commit 455bbeae38
2 changed files with 26 additions and 19 deletions

View File

@ -1,3 +1,11 @@
2004-03-31 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::recvfrom): Always initialize
ret to 0 when using in Winsock call.
(fhandler_socket::recvmsg): Ditto.
(fhandler_socket::sendto): Ditto.
(fhandler_socket::sendmsg): Ditto.
2004-03-31 Corinna Vinschen <corinna@vinschen.de> 2004-03-31 Corinna Vinschen <corinna@vinschen.de>
* fhandler_tape.cc (mtinfo_drive::get_pos): Only set partition if * fhandler_tape.cc (mtinfo_drive::get_pos): Only set partition if

View File

@ -727,8 +727,8 @@ fhandler_socket::recvfrom (void *ptr, size_t len, int flags,
WSABUF wsabuf = { len, (char *) ptr }; WSABUF wsabuf = { len, (char *) ptr };
if (is_nonblocking () || has_been_closed) if (is_nonblocking () || has_been_closed)
res = WSARecvFrom (get_socket (), &wsabuf, 1, &ret, (DWORD *) &flags, res = WSARecvFrom (get_socket (), &wsabuf, 1, (ret = 0, &ret),
from, fromlen, NULL, NULL); (DWORD *) &flags, from, fromlen, NULL, NULL);
else else
{ {
wsock_event wsock_evt; wsock_event wsock_evt;
@ -738,9 +738,9 @@ fhandler_socket::recvfrom (void *ptr, size_t len, int flags,
do do
{ {
if (!(res = wsock_evt.wait (get_socket (), has_been_closed))) if (!(res = wsock_evt.wait (get_socket (), has_been_closed)))
res = WSARecvFrom (get_socket (), &wsabuf, 1, &ret, res = WSARecvFrom (get_socket (), &wsabuf, 1,
(DWORD *) &flags, from, fromlen, (ret = 0, &ret), (DWORD *) &flags,
NULL, NULL); from, fromlen, NULL, NULL);
} }
while (res == SOCKET_ERROR while (res == SOCKET_ERROR
&& WSAGetLastError () == WSAEWOULDBLOCK && WSAGetLastError () == WSAEWOULDBLOCK
@ -853,9 +853,8 @@ fhandler_socket::recvmsg (struct msghdr *msg, int flags, ssize_t tot)
if (is_nonblocking () || has_been_closed) if (is_nonblocking () || has_been_closed)
res = WSARecvFrom (get_socket (), res = WSARecvFrom (get_socket (),
wsabuf, iovcnt, &ret, (DWORD *) &flags, wsabuf, iovcnt, (ret = 0, &ret), (DWORD *) &flags,
from, fromlen, from, fromlen, NULL, NULL);
NULL, NULL);
else else
{ {
wsock_event wsock_evt; wsock_event wsock_evt;
@ -865,9 +864,9 @@ fhandler_socket::recvmsg (struct msghdr *msg, int flags, ssize_t tot)
do do
{ {
if (!(res = wsock_evt.wait (get_socket (), has_been_closed))) if (!(res = wsock_evt.wait (get_socket (), has_been_closed)))
res = WSARecvFrom (get_socket (), wsabuf, iovcnt, &ret, res = WSARecvFrom (get_socket (), wsabuf, iovcnt,
(DWORD *) &flags, from, fromlen, (ret = 0, &ret), (DWORD *) &flags,
NULL, NULL); from, fromlen, NULL, NULL);
} }
while (res == SOCKET_ERROR while (res == SOCKET_ERROR
&& WSAGetLastError () == WSAEWOULDBLOCK && WSAGetLastError () == WSAEWOULDBLOCK
@ -930,7 +929,7 @@ fhandler_socket::sendto (const void *ptr, size_t len, int flags,
WSABUF wsabuf = { len, (char *) ptr }; WSABUF wsabuf = { len, (char *) ptr };
if (is_nonblocking () || has_been_closed) if (is_nonblocking () || has_been_closed)
res = WSASendTo (get_socket (), &wsabuf, 1, &ret, res = WSASendTo (get_socket (), &wsabuf, 1, (ret = 0, &ret),
flags & MSG_WINMASK, flags & MSG_WINMASK,
(to ? (const struct sockaddr *) &sin : NULL), tolen, (to ? (const struct sockaddr *) &sin : NULL), tolen,
NULL, NULL); NULL, NULL);
@ -941,7 +940,7 @@ fhandler_socket::sendto (const void *ptr, size_t len, int flags,
{ {
do do
{ {
res = WSASendTo (get_socket (), &wsabuf, 1, &ret, res = WSASendTo (get_socket (), &wsabuf, 1, (ret = 0, &ret),
flags & MSG_WINMASK, flags & MSG_WINMASK,
(to ? (const struct sockaddr *) &sin : NULL), (to ? (const struct sockaddr *) &sin : NULL),
tolen, NULL, NULL); tolen, NULL, NULL);
@ -1066,10 +1065,9 @@ fhandler_socket::sendmsg (const struct msghdr *msg, int flags, ssize_t tot)
DWORD ret; DWORD ret;
if (is_nonblocking () || has_been_closed) if (is_nonblocking () || has_been_closed)
res = WSASendTo (get_socket (), wsabuf, iovcnt, &ret, flags, res = WSASendTo (get_socket (), wsabuf, iovcnt, (ret = 0, &ret),
(struct sockaddr *) msg->msg_name, flags, (struct sockaddr *) msg->msg_name,
msg->msg_namelen, msg->msg_namelen, NULL, NULL);
NULL, NULL);
else else
{ {
wsock_event wsock_evt; wsock_event wsock_evt;
@ -1077,8 +1075,9 @@ fhandler_socket::sendmsg (const struct msghdr *msg, int flags, ssize_t tot)
{ {
do do
{ {
res = WSASendTo (get_socket (), wsabuf, iovcnt, &ret, res = WSASendTo (get_socket (), wsabuf, iovcnt,
flags, (struct sockaddr *) msg->msg_name, (ret = 0, &ret), flags,
(struct sockaddr *) msg->msg_name,
msg->msg_namelen, NULL, NULL); msg->msg_namelen, NULL, NULL);
if (res != SOCKET_ERROR if (res != SOCKET_ERROR
|| WSAGetLastError () != WSAEWOULDBLOCK) || WSAGetLastError () != WSAEWOULDBLOCK)