From: Kevin McCarthy Date: Mon, 5 Sep 2016 19:35:19 +0000 (-0700) Subject: Stub out getdnsdomainname() unless HAVE_GETADDRINFO. X-Git-Tag: mutt-1-7-1-rel~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fffb9d0439ba3a9f25bccc87f0822ce9f1a84565;p=mutt Stub out getdnsdomainname() unless HAVE_GETADDRINFO. It seems unlikely there are systems without it (given that this mistake has been in since 1.6.0), but for correctness we should stub out the function for those without it. --- diff --git a/getdomain.c b/getdomain.c index 9dfda2bd..15803afb 100644 --- a/getdomain.c +++ b/getdomain.c @@ -31,19 +31,21 @@ int getdnsdomainname (char *d, size_t len) { - /* A DNS name can actually be only 253 octets, string is 256 */ + int ret = -1; + +#ifdef HAVE_GETADDRINFO char *node; long node_len; struct addrinfo hints; struct addrinfo *h; char *p; - int ret; *d = '\0'; memset(&hints, 0, sizeof (struct addrinfo)); hints.ai_flags = AI_CANONNAME; hints.ai_family = AF_UNSPEC; + /* A DNS name can actually be only 253 octets, string is 256 */ if ((node_len = sysconf(_SC_HOST_NAME_MAX)) == -1) node_len = STRING; node = safe_malloc(node_len + 1); @@ -64,6 +66,8 @@ int getdnsdomainname (char *d, size_t len) freeaddrinfo(h); } FREE (&node); +#endif + return ret; }