Mike McCormack : rpcrt4: Invalid sockets should have a value of -1.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Apr 21 06:17:20 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 481cec40069392e8e7c48cd62d8dc84e10f2cf8b
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=481cec40069392e8e7c48cd62d8dc84e10f2cf8b

Author: Mike McCormack <mike at codeweavers.com>
Date:   Fri Apr 21 18:38:01 2006 +0900

rpcrt4: Invalid sockets should have a value of -1.

---

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

diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index 4faad59..563a0df 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -254,7 +254,10 @@ typedef struct _RpcConnection_tcp
 
 static RpcConnection *rpcrt4_conn_tcp_alloc(void)
 {
-  return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcConnection_tcp));
+  RpcConnection_tcp *tcpc;
+  tcpc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcConnection_tcp));
+  tcpc->sock = -1;
+  return &tcpc->common;
 }
 
 static RPC_STATUS rpcrt4_ncacn_ip_tcp_open(RpcConnection* Connection)
@@ -271,7 +274,7 @@ static RPC_STATUS rpcrt4_ncacn_ip_tcp_op
     return RPC_S_SERVER_UNAVAILABLE;
   }
 
-  if (tcpc->sock)
+  if (tcpc->sock != -1)
     return RPC_S_OK;
 
   sa.sin_family = AF_INET;
@@ -335,9 +338,9 @@ static int rpcrt4_conn_tcp_close(RpcConn
   RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
 
   TRACE("%d\n", tcpc->sock);
-  if (tcpc->sock)
+  if (tcpc->sock != -1)
     close(tcpc->sock);
-  tcpc->sock = 0;
+  tcpc->sock = -1;
   return 0;
 }
 




More information about the wine-cvs mailing list