From 481cec40069392e8e7c48cd62d8dc84e10f2cf8b Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Fri, 21 Apr 2006 18:38:01 +0900 Subject: [PATCH] rpcrt4: Invalid sockets should have a value of -1. --- dlls/rpcrt4/rpc_transport.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c index 4faad59d05..563a0df6bb 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_open(RpcConnection* Connection) 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(RpcConnection *Connection) 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; }