nbdkit/0008-server-Work-around-inc...

47 lines
1.4 KiB
Diff

From a009e5456582c17d537e63b34fecca99a2d58867 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 27 Jun 2022 11:59:57 +0100
Subject: [PATCH] server: Work around incorrect include in gnutls/socket.h
On MinGW:
In file included from crypto.c:56:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/gnutls/socket.h:32:10: fatal error: sys/socket.h: No such file or directory
32 | #include <sys/socket.h>
| ^~~~~~~~~~~~~~
gnutls/socket.h shouldn't include this header on MinGW. As a
workaround until this is fixed, only include the header when we know
that the function we need is available.
We will need to revisit this fix when gnutls is fixed.
Link: https://gitlab.com/gnutls/gnutls/-/issues/1382
Updates: commit fd626688845324a4b3c387fa901d96e5d20ea634
(cherry picked from commit efc6e3e9b8448ae9530ffab3e95adf072ff02adf)
---
server/crypto.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/server/crypto.c b/server/crypto.c
index 51a83b4d..06c719f5 100644
--- a/server/crypto.c
+++ b/server/crypto.c
@@ -53,9 +53,12 @@
#ifdef HAVE_GNUTLS
#include <gnutls/gnutls.h>
-#include <gnutls/socket.h>
#include <gnutls/x509.h>
+#ifdef HAVE_GNUTLS_TRANSPORT_IS_KTLS_ENABLED
+#include <gnutls/socket.h>
+#endif
+
static int crypto_auth;
#define CRYPTO_AUTH_CERTIFICATES 1
#define CRYPTO_AUTH_PSK 2
--
2.31.1