]> sjero.net Git - wget/commitdiff
Use always close as it is defined by gnulib on platforms lacking it.
authorGiuseppe Scrivano <gscrivano@gnu.org>
Fri, 7 May 2010 11:27:11 +0000 (13:27 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Fri, 7 May 2010 11:27:11 +0000 (13:27 +0200)
src/ChangeLog
src/gnutls.c
src/openssl.c

index b0871e7df36c73b14375f37e32beb393357bb7fe..473d4c648bfe9de13598b0f9b245778ec9308b40 100644 (file)
@@ -1,5 +1,11 @@
 2010-05-07  Giuseppe Scrivano  <gscrivano@gnu.org>
 
+       * gnutls.c (wgnutls_close): Use always `close', not `closesocket'.
+
+       * openssl.c (openssl_close): Use always `close', not `closesocket'.
+       (ssl_connect_wget): Get the real socket handle by FD_TO_SOCKET.
+       Define FD_TO_SOCKET if it is not yet defined.
+
        * Makefile.am (libunittest_a_CPPFLAGS): Add -I$(top_builddir)/lib.
 
        * mswindows.h: Always include <winsock2.h> and <ws2tcpip.h>.  Do not
index af46171f39199b605af814f602dc1f30a866687c..0bb49ca533cd794b56ccd4420d74e51f31b15b0c 100644 (file)
@@ -165,11 +165,7 @@ wgnutls_close (int fd, void *arg)
   /*gnutls_bye (ctx->session, GNUTLS_SHUT_RDWR);*/
   gnutls_deinit (ctx->session);
   xfree (ctx);
-#ifndef WINDOWS
   close (fd);
-#else
-  closesocket (fd);
-#endif
 }
 
 /* gnutls_transport is the singleton that describes the SSL transport
index 1823f5935655a15a4b8d92279a9cb5129acb63c2..9bc59a5ce606d3e2f8984acfb6ec3ee629b2796f 100644 (file)
@@ -364,11 +364,7 @@ openssl_close (int fd, void *arg)
   xfree_null (ctx->last_error);
   xfree (ctx);
 
-#if defined(WINDOWS) || defined(USE_WATT32)
-  closesocket (fd);
-#else
   close (fd);
-#endif
 
   DEBUGP (("Closed %d/SSL 0x%0*lx\n", fd, PTR_FORMAT (conn)));
 }
@@ -401,7 +397,10 @@ ssl_connect_wget (int fd)
   conn = SSL_new (ssl_ctx);
   if (!conn)
     goto error;
-  if (!SSL_set_fd (conn, fd))
+#ifndef FD_TO_SOCKET
+# define FD_TO_SOCKET(x) (x)
+#endif
+  if (!SSL_set_fd (conn, FD_TO_SOCKET (fd)))
     goto error;
   SSL_set_connect_state (conn);
   if (SSL_connect (conn) <= 0 || conn->state != SSL_ST_OK)