diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-09-28 13:26:35 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-09-28 13:26:35 +0000 |
commit | 4362ca010d55cce9e3f9e612961f4d1c9b42e6b6 (patch) | |
tree | fe31a52ecc73e2032068cc83a1380962ef12ff1b | |
parent | e8948b0aca9adf5520d945752ea57f63268966c7 (diff) |
bzzzt
-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; |