]> granicus.if.org Git - mutt/commitdiff
Stub out getdnsdomainname() unless HAVE_GETADDRINFO.
authorKevin McCarthy <kevin@8t8.us>
Mon, 5 Sep 2016 19:35:19 +0000 (12:35 -0700)
committerKevin McCarthy <kevin@8t8.us>
Mon, 5 Sep 2016 19:35:19 +0000 (12:35 -0700)
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.

getdomain.c

index 9dfda2bdc9282329b13d9dc2ce478626fbeec497..15803afb37fb553de650295d2ba1e79d600d21e7 100644 (file)
 
 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;
 }