cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] gnutls 3 compatibility

From: Mark Brand <mabrand_at_mabrand.nl>
Date: Fri, 28 Oct 2011 15:28:26 +0200

Hi,

Gnutls 3 lost gnutls_transport_set_global_errno(). The following patch
brings it back so curl will build. Obviously a real curl developer will
probably know the right way to do this..

By the way, gnutls_transport_set_lowat is lost as well(), but commit
8036da8 deals with this.

With the 2 mentioned patches, curl-7_22_0 builds for me using gnutls 3.0.5.

regards,

Mark

diff --git a/lib/gtls.c b/lib/gtls.c
index 7ca46c8..b4fc616 100644
--- a/lib/gtls.c
+++ b/lib/gtls.c
@@ -113,6 +113,31 @@ static int gtls_mapped_sockerrno(void)
    }
    return gtls_EIO;
  }
+#if GNUTLS_VERSION_NUMBER >= 0x030000
+# fixme: ugly workaround for loss of this gnutls function
+void
+gnutls_transport_set_global_errno (int err)
+{
+#ifdef _WIN32
+ /* Keep this in sync with system_errno */
+ switch (err)
+ {
+ case EAGAIN:
+ SetLastError (WSAEWOULDBLOCK);
+ break;
+ case EINTR:
+ SetLastError (WSAEINTR);
+ break;
+ default:
+ /* We don't care about anything else */
+ SetLastError (NO_ERROR);
+ break;
+ }
+#else
+ errno = err;
+#endif
+}
+#endif
  #endif

  static ssize_t Curl_gtls_push(void *s, const void *buf, size_t len)

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-10-28