ws2_32, WS2_sendto: Avoid error when sending zero bytes (bug #19397)

Wolfgang Schwotzer wolfgang.schwotzer at gmx.net
Sat Aug 14 04:23:16 CDT 2010


---
 dlls/ws2_32/socket.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index f129b08..b143f1f 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3326,10 +3326,16 @@ static int WS2_sendto( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
         goto error;
     }
 
-    for (;;)
+    if (totalLength > 0)
     {
-        n = WS2_send( fd, wsa );
-        if (n != -1 || errno != EINTR) break;
+        for (;;)
+        {
+            n = WS2_send( fd, wsa );
+            if (n != -1 || errno != EINTR) break;
+        }
+    } else {
+        n = 0;
+        errno = 0;
     }
     if (n == -1 && errno != EAGAIN)
     {
-- 
1.6.3.3


--------------000402070904080104050709--



More information about the wine-patches mailing list