]> sjero.net Git - wget/blobdiff - src/gnutls.c
gnutls: Remove two unused variables.
[wget] / src / gnutls.c
index dfff00cf5bf6e0ffc950fc55f885ddc466b9b726..2a1d22b9ed3ad91a942d5a0261a961e776b6371d 100644 (file)
@@ -48,6 +48,8 @@ as that of the covered work.  */
 #include "ptimer.h"
 #include "ssl.h"
 
+#include <sys/fcntl.h>
+
 #ifdef WIN32
 # include "w32sock.h"
 #endif
@@ -61,6 +63,13 @@ static gnutls_certificate_credentials credentials;
 bool
 ssl_init ()
 {
+  /* Becomes true if GnuTLS is initialized. */
+  static bool ssl_initialized = false;
+
+  /* GnuTLS should be initialized only once. */
+  if (ssl_initialized)
+    return true;
+
   const char *ca_directory;
   DIR *dir;
 
@@ -102,6 +111,9 @@ ssl_init ()
   if (opt.ca_cert)
     gnutls_certificate_set_x509_trust_file (credentials, opt.ca_cert,
                                             GNUTLS_X509_FMT_PEM);
+
+  ssl_initialized = true;
+
   return true;
 }
 
@@ -205,11 +217,7 @@ wgnutls_read_timeout (int fd, char *buf, int bufsize, void *arg, double timeout)
 static int
 wgnutls_read (int fd, char *buf, int bufsize, void *arg)
 {
-#ifdef F_GETFL
-  int flags = 0;
-#endif
   int ret = 0;
-  struct ptimer *timer;
   struct wgnutls_transport_context *ctx = arg;
 
   if (ctx->peeklen)