Portability: common-src/glib-util.c

[email protected] (Eric Schnoebelen)
Newsgroups gmane.comp.archivers.amanda.devel
Message-ID <[email protected]>
Issue: Attempting to use libcurl macros when libcurl was not
configured on the system in common-src/glib-util.c

Solution: Make sure to use the feature test macro for LIBCURL
before trying to use either the GNUTLS or OPENSSL feature test
macros.

patch included in line and as an attachment


$NetBSD$

confirm we HAVE_LIBCURL before using LIBCURL_USE_OPENSSL, as the latter 
is defined if curl is found on the system, but libcurl was not
configured.

--- common-src/glib-util.c.orig	2016-09-29 16:18:52.000000000 +0000
+++ common-src/glib-util.c
@@ -36,7 +36,7 @@
 #include <curl/curl.h>
 #endif
 
-#if defined LIBCURL_USE_OPENSSL || defined SSL_SECURITY
+#if (defined HAVE_LIBCURL && defined LIBCURL_USE_OPENSSL) || defined SSL_SECURITY
 #include <openssl/crypto.h>
 #include <openssl/ssl.h>
 #if OPENSSL_VERSION_NUMBER < 0x10100000L
@@ -74,7 +74,7 @@ init_openssl(void)
 
 #endif /* LIBCURL_USE_OPENSSL */
 
-#if defined LIBCURL_USE_GNUTLS_GCRYPT
+#if defined HAVE_LIBCURL && defined LIBCURL_USE_GNUTLS_GCRYPT
 
 #include <gcrypt.h>
 #include <errno.h>
@@ -97,10 +97,10 @@ static void
 init_ssl(void)
 {
 
-#if defined LIBCURL_USE_OPENSSL || defined SSL_SECURITY
+#if (defined HAVE_LIBCURL && defined LIBCURL_USE_OPENSSL) || defined SSL_SECURITY
     init_openssl();
 #endif
-#if defined LIBCURL_USE_GNUTLS_GCRYPT
+#if defined HAVE_LIBCURL && defined LIBCURL_USE_GNUTLS_GCRYPT
     init_gnutls_gcrypt();
 #endif
 }
common-src_glib-util.c.patch (text/plain, 1.1 KB)
$NetBSD$

confirm we HAVE_LIBCURL before using LIBCURL_USE_OPENSSL, as the latter 
is defined if curl is found on the system, but libcurl was not
configured.

--- common-src/glib-util.c.orig	2016-09-29 16:18:52.000000000 +0000
+++ common-src/glib-util.c
@@ -36,7 +36,7 @@
 #include <curl/curl.h>
 #endif
 
-#if defined LIBCURL_USE_OPENSSL || defined SSL_SECURITY
+#if (defined HAVE_LIBCURL && defined LIBCURL_USE_OPENSSL) || defined SSL_SECURITY
 #include <openssl/crypto.h>
 #include <openssl/ssl.h>
 #if OPENSSL_VERSION_NUMBER < 0x10100000L
@@ -74,7 +74,7 @@ init_openssl(void)
 
 #endif /* LIBCURL_USE_OPENSSL */
 
-#if defined LIBCURL_USE_GNUTLS_GCRYPT
+#if defined HAVE_LIBCURL && defined LIBCURL_USE_GNUTLS_GCRYPT
 
 #include <gcrypt.h>
 #include <errno.h>
@@ -97,10 +97,10 @@ static void
 init_ssl(void)
 {
 
-#if defined LIBCURL_USE_OPENSSL || defined SSL_SECURITY
+#if (defined HAVE_LIBCURL && defined LIBCURL_USE_OPENSSL) || defined SSL_SECURITY
     init_openssl();
 #endif
-#if defined LIBCURL_USE_GNUTLS_GCRYPT
+#if defined HAVE_LIBCURL && defined LIBCURL_USE_GNUTLS_GCRYPT
     init_gnutls_gcrypt();
 #endif
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.