build fixes for 2.1.11 - EAI_NODATA, EAI_ADDRFAMILY

Christoph Moench-Tegeder cmt at burggraben.net
Wed Jan 27 09:32:41 CET 2016


Hi,

when compiling gnupg 2.1.11 on FreeBSD 10.2, the build fails in
dirmngr/dns-stuff.c as EAI_NODATA and EAI_ADDRFAMILY are not
defined on FreeBSD:

dns-stuff.c:180:10: error: use of undeclared identifier 'EAI_NODATA'
    case EAI_NODATA:    err = gpg_error (GPG_ERR_NO_DATA); break;
         ^
dns-stuff.c:186:10: error: use of undeclared identifier 'EAI_ADDRFAMILY'
    case EAI_ADDRFAMILY:err = gpg_error (GPG_ERR_EADDRNOTAVAIL); break;

In fact, those defines are disabled as "obsoleted" in netdb.h, and
IEEE 1003.1-2013 does not mention those constants.
NOTE: the code in question was already in 2.1.10, but I missed that
release.

To work around this, I propose the following patch:

--- dirmngr/dns-stuff.c.orig	2016-01-27 09:08:32.073992000 +0100
+++ dirmngr/dns-stuff.c	2016-01-27 09:09:23.454463000 +0100
@@ -177,13 +177,17 @@
     case EAI_BADFLAGS:  err = gpg_error (GPG_ERR_INV_FLAG); break;
     case EAI_FAIL:      err = gpg_error (GPG_ERR_SERVER_FAILED); break;
     case EAI_MEMORY:    err = gpg_error (GPG_ERR_ENOMEM); break;
+#ifdef EAI_NODATA
     case EAI_NODATA:    err = gpg_error (GPG_ERR_NO_DATA); break;
+#endif 
     case EAI_NONAME:    err = gpg_error (GPG_ERR_NO_NAME); break;
     case EAI_SERVICE:   err = gpg_error (GPG_ERR_NOT_SUPPORTED); break;
     case EAI_FAMILY:    err = gpg_error (GPG_ERR_EAFNOSUPPORT); break;
     case EAI_SOCKTYPE:  err = gpg_error (GPG_ERR_ESOCKTNOSUPPORT); break;
 #ifndef HAVE_W32_SYSTEM
+#ifdef EAI_ADDRFAMILY
     case EAI_ADDRFAMILY:err = gpg_error (GPG_ERR_EADDRNOTAVAIL); break;
+#endif
     case EAI_SYSTEM:    err = gpg_error_from_syserror (); break;
 #endif
     default:            err = gpg_error (GPG_ERR_UNKNOWN_ERRNO); break;

Regards,
Christoph

-- 
Spare Space



More information about the Gnupg-devel mailing list