summaryrefslogtreecommitdiff
path: root/xhost.c
diff options
context:
space:
mode:
Diffstat (limited to 'xhost.c')
-rw-r--r--xhost.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/xhost.c b/xhost.c
index 6398506..9b0a093 100644
--- a/xhost.c
+++ b/xhost.c
@@ -394,11 +394,21 @@ change_host(Display *dpy, char *name, Bool add)
name += 3;
}
if (family == FamilyWild && (cp = strchr(lname, ':'))) {
- *cp = '\0';
- fprintf (stderr, "%s: unknown address family \"%s\"\n",
- ProgramName, lname);
- free(lname);
- return 0;
+#ifdef IPv6
+ /*
+ * Check to see if inet_pton() can grok it as an IPv6 address
+ */
+ if (inet_pton(AF_INET6, lname, &addr6.s6_addr) == 1) {
+ family = FamilyInternet6;
+ } else
+#endif
+ {
+ *cp = '\0';
+ fprintf (stderr, "%s: unknown address family \"%s\"\n",
+ ProgramName, lname);
+ free(lname);
+ return 0;
+ }
}
free(lname);