diff options
author | ume <ume@FreeBSD.org> | 2000-05-24 11:24:49 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2000-05-24 11:24:49 +0000 |
commit | aee7c5eed195e4d57e1b593bde1822c0b63e94a2 (patch) | |
tree | d8bcdb1b3b97f7c002165cd04f1ad21446453b8e /lib/libutil | |
parent | 033beddf154522efc42028a51970096c5f5d44ba (diff) | |
download | FreeBSD-src-aee7c5eed195e4d57e1b593bde1822c0b63e94a2.zip FreeBSD-src-aee7c5eed195e4d57e1b593bde1822c0b63e94a2.tar.gz |
We should see the ai_canonname menber of the first addrinfo
structure in the linked list. RFC2553 mentions only first.
Reviewed by: shin
Diffstat (limited to 'lib/libutil')
-rw-r--r-- | lib/libutil/realhostname.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libutil/realhostname.c b/lib/libutil/realhostname.c index a1cd72d..a0febb8 100644 --- a/lib/libutil/realhostname.c +++ b/lib/libutil/realhostname.c @@ -127,16 +127,16 @@ realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen) result = HOSTNAME_FOUND; ((struct sockinet *)addr)->si_port = port; - if (res->ai_canonname == 0) { + if (ores->ai_canonname == 0) { freeaddrinfo(ores); goto numeric; } - if (strlen(res->ai_canonname) > hsize && + if (strlen(ores->ai_canonname) > hsize && addr->sa_family == AF_INET) { freeaddrinfo(ores); goto numeric; } - strncpy(host, res->ai_canonname, + strncpy(host, ores->ai_canonname, hsize); break; } @@ -158,12 +158,12 @@ realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen) !memcmp(&in6->s6_addr[12], in, sizeof(*in))) { result = HOSTNAME_FOUND; - if (res->ai_canonname == 0 || - strlen(res->ai_canonname) > hsize) { + if (ores->ai_canonname == 0 || + strlen(ores->ai_canonname) > hsize) { freeaddrinfo(ores); goto numeric; } - strncpy(host, res->ai_canonname, + strncpy(host, ores->ai_canonname, hsize); break; } |