diff options
author | 1996-09-28 13:26:34 +0000 | |
---|---|---|
committer | 1996-09-28 13:26:34 +0000 | |
commit | 8f230df511e0dfa19d1da1dad493d0d01bef9e5d (patch) | |
tree | 312d469e1024aba69eb7d4d85743664816fbca8f /lib | |
parent | New fallback alg. added for arc machines. If libxx.so is not found scan for highest (diff) | |
download | wireguard-openbsd-8f230df511e0dfa19d1da1dad493d0d01bef9e5d.tar.xz wireguard-openbsd-8f230df511e0dfa19d1da1dad493d0d01bef9e5d.zip |
bzzzt
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/gethostnamadr.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c index c9220e1cf67..6d5124d3083 100644 --- a/lib/libc/net/gethostnamadr.c +++ b/lib/libc/net/gethostnamadr.c @@ -52,7 +52,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.11 1996/09/27 18:50:04 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.12 1996/09/28 13:26:34 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -171,7 +171,6 @@ getanswer(answer, anslen, iquery) } cp += n + QFIXEDSZ; host.h_name = bp; - host.h_length = INADDRSZ; n = strlen(bp); if (n >= MAXHOSTNAMELEN) host.h_name[MAXHOSTNAMELEN-1] = '\0'; @@ -241,17 +240,21 @@ getanswer(answer, anslen, iquery) continue; } - if (n != host.h_length) { - cp += n; - continue; - } - if (class != getclass) { - cp += n; - continue; - } - if (!haveanswer) { + if (haveanswer) { + if (n != host.h_length) { + cp += n; + continue; + } + if (class != getclass) { + cp += n; + continue; + } + } else { + host.h_length = n; getclass = class; host.h_addrtype = (class == C_IN) ? AF_INET : AF_UNSPEC; + if (host.h_addrtype == AF_INET) + host.h_length = INADDRSZ; if (!iquery) { host.h_name = bp; bp += strlen(bp) + 1; |