[patch] rpcrt4_conn_np_read needs to expect and accept ERROR_MORE_DATA

Juan Lang juan.lang at gmail.com
Fri Feb 6 06:35:25 CST 2009


Hi Luke,

@@ -382,7 +382,14 @@ static int rpcrt4_conn_np_read(RpcConnection *Connection,
   {
     DWORD bytes_read;
     ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, NULL);
-    if (!ret || !bytes_read)
+    if (!ret)
+    {
+      TRACE("ReadFile error, status %x\n", GetLastError());
+      if (GetLastError() != ERROR_MORE_DATA)
+         break;
+      ret = TRUE; /* ERROR_MORE_DATA is an expected acceptable error code */
+    }
+    if (!bytes_read)
         break;

Style nit:  it would be simpler to do:
     DWORD bytes_read;
     ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, NULL);
+    if (!ret && GetLastError() == ERROR_MORE_DATA)
+        ret = TRUE;
     if (!ret || !bytes_read)
         break;

Don't you think?
--Juan



More information about the wine-devel mailing list