diff options
author | Brian Somers <brian@FreeBSD.org> | 2001-07-21 00:18:54 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 2001-07-21 00:18:54 +0000 |
commit | 3ee63d3929df48b8ae485d476471a05cff01daf2 (patch) | |
tree | f94abe89500d848fd9fd54576d843ba13eac7372 /lib/libutil/realhostname.c | |
parent | a5dd141db658bc635de725a122d18698d5aaafc3 (diff) | |
download | src-3ee63d3929df48b8ae485d476471a05cff01daf2.tar.gz src-3ee63d3929df48b8ae485d476471a05cff01daf2.zip |
Notes
Diffstat (limited to 'lib/libutil/realhostname.c')
-rw-r--r-- | lib/libutil/realhostname.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libutil/realhostname.c b/lib/libutil/realhostname.c index 7c409a8cfe70..258d8306d3b9 100644 --- a/lib/libutil/realhostname.c +++ b/lib/libutil/realhostname.c @@ -102,8 +102,15 @@ realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen) struct sockaddr *sa; memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = - (addr->sa_family == AF_INET) ? AF_INET : AF_UNSPEC; + switch (addr->sa_family) { + case AF_INET: + case AF_INET6: + hints.ai_family = addr->sa_family; + break; + default: + hints.ai_family = AF_UNSPEC; + break; + } hints.ai_flags = AI_CANONNAME; error = getaddrinfo(buf, NULL, &hints, &res); |