Rob Shearman : rpcrt4: Use closesocket to close sockets and define it to close on Unix platforms to make the code more portable .

Alexandre Julliard julliard at winehq.org
Thu Mar 6 11:08:37 CST 2008


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Thu Mar  6 14:59:02 2008 +0000

rpcrt4: Use closesocket to close sockets and define it to close on Unix platforms to make the code more portable.

---

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

diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index 0859537..b02c11d 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -64,6 +64,7 @@
 # ifdef HAVE_SYS_POLL_H
 #  include <sys/poll.h>
 # endif
+# define closesocket close
 #endif /* defined(__MINGW32__) || defined (_MSC_VER) */
 
 #include "windef.h"
@@ -801,7 +802,7 @@ static RPC_STATUS rpcrt4_ncacn_ip_tcp_open(RpcConnection* Connection)
     if (0>connect(sock, ai_cur->ai_addr, ai_cur->ai_addrlen))
     {
       WARN("connect() failed: %s\n", strerror(errno));
-      close(sock);
+      closesocket(sock);
       continue;
     }
 
@@ -880,7 +881,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(RpcServerProtseq *pr
         if (ret < 0)
         {
             WARN("bind failed: %s\n", strerror(errno));
-            close(sock);
+            closesocket(sock);
             if (errno == EADDRINUSE)
               status = RPC_S_DUPLICATE_ENDPOINT;
             else
@@ -892,7 +893,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(RpcServerProtseq *pr
                                                 endpoint, NULL, NULL, NULL);
         if (create_status != RPC_S_OK)
         {
-            close(sock);
+            closesocket(sock);
             status = create_status;
             continue;
         }
@@ -1046,7 +1047,7 @@ static int rpcrt4_conn_tcp_close(RpcConnection *Connection)
   TRACE("%d\n", tcpc->sock);
 
   if (tcpc->sock != -1)
-    close(tcpc->sock);
+    closesocket(tcpc->sock);
   tcpc->sock = -1;
   close(tcpc->cancel_fds[0]);
   close(tcpc->cancel_fds[1]);




More information about the wine-cvs mailing list