summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2016-09-05 12:35:19 -0700
committerKevin McCarthy <kevin@8t8.us>2016-09-05 12:35:19 -0700
commitfffb9d0439ba3a9f25bccc87f0822ce9f1a84565 (patch)
treeb6942d0684becc11092cec7833304bbe51905df6
parent7f33a70bb77390e148b2dfeae321b2e6e6696d37 (diff)
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.
-rw-r--r--getdomain.c8
1 files changed, 6 insertions, 2 deletions
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;
}