Rob Shearman : rpcrt4: Fix rpcrt4_conn_tcp_read and rpcrt4_conn_tcp_write for reading/ writing zero-sized data.

Alexandre Julliard julliard at winehq.org
Mon Dec 14 09:51:18 CST 2009


Module: wine
Branch: master
Commit: ceb7fda37440f042abffce1b10a5a3aaaa181d91
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ceb7fda37440f042abffce1b10a5a3aaaa181d91

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Sun Dec 13 21:35:34 2009 +0000

rpcrt4: Fix rpcrt4_conn_tcp_read and rpcrt4_conn_tcp_write for reading/writing zero-sized data.

---

 dlls/rpcrt4/rpc_transport.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index 5d38b6e..5c7edea 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -1345,7 +1345,7 @@ static int rpcrt4_conn_tcp_read(RpcConnection *Connection,
 {
   RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
   int bytes_read = 0;
-  do
+  while (bytes_read != count)
   {
     int r = recv(tcpc->sock, (char *)buffer + bytes_read, count - bytes_read, 0);
     if (!r)
@@ -1362,7 +1362,7 @@ static int rpcrt4_conn_tcp_read(RpcConnection *Connection,
       if (!rpcrt4_sock_wait_for_recv(tcpc))
         return -1;
     }
-  } while (bytes_read != count);
+  }
   TRACE("%d %p %u -> %d\n", tcpc->sock, buffer, count, bytes_read);
   return bytes_read;
 }
@@ -1372,7 +1372,7 @@ static int rpcrt4_conn_tcp_write(RpcConnection *Connection,
 {
   RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
   int bytes_written = 0;
-  do
+  while (bytes_written != count)
   {
     int r = send(tcpc->sock, (const char *)buffer + bytes_written, count - bytes_written, 0);
     if (r >= 0)
@@ -1384,7 +1384,7 @@ static int rpcrt4_conn_tcp_write(RpcConnection *Connection,
       if (!rpcrt4_sock_wait_for_send(tcpc))
         return -1;
     }
-  } while (bytes_written != count);
+  }
   TRACE("%d %p %u -> %d\n", tcpc->sock, buffer, count, bytes_written);
   return bytes_written;
 }




More information about the wine-cvs mailing list