summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorderaadt <>1996-09-28 13:26:34 +0000
committerderaadt <>1996-09-28 13:26:34 +0000
commitf31b0f0048dca1800699df5a79d7f3c9067a6a03 (patch)
tree86701f14eefe0a1d6cd7ded211d56062938e9607 /src/lib
parent43ef223d5a60bdb1a88a9a2fe624015c4732ed01 (diff)
downloadopenbsd-f31b0f0048dca1800699df5a79d7f3c9067a6a03.tar.gz
openbsd-f31b0f0048dca1800699df5a79d7f3c9067a6a03.tar.bz2
openbsd-f31b0f0048dca1800699df5a79d7f3c9067a6a03.zip
bzzzt
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libc/net/gethostnamadr.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/lib/libc/net/gethostnamadr.c b/src/lib/libc/net/gethostnamadr.c
index c9220e1cf6..6d5124d308 100644
--- a/src/lib/libc/net/gethostnamadr.c
+++ b/src/lib/libc/net/gethostnamadr.c
@@ -52,7 +52,7 @@
52 */ 52 */
53 53
54#if defined(LIBC_SCCS) && !defined(lint) 54#if defined(LIBC_SCCS) && !defined(lint)
55static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.11 1996/09/27 18:50:04 deraadt Exp $"; 55static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.12 1996/09/28 13:26:34 deraadt Exp $";
56#endif /* LIBC_SCCS and not lint */ 56#endif /* LIBC_SCCS and not lint */
57 57
58#include <sys/param.h> 58#include <sys/param.h>
@@ -171,7 +171,6 @@ getanswer(answer, anslen, iquery)
171 } 171 }
172 cp += n + QFIXEDSZ; 172 cp += n + QFIXEDSZ;
173 host.h_name = bp; 173 host.h_name = bp;
174 host.h_length = INADDRSZ;
175 n = strlen(bp); 174 n = strlen(bp);
176 if (n >= MAXHOSTNAMELEN) 175 if (n >= MAXHOSTNAMELEN)
177 host.h_name[MAXHOSTNAMELEN-1] = '\0'; 176 host.h_name[MAXHOSTNAMELEN-1] = '\0';
@@ -241,17 +240,21 @@ getanswer(answer, anslen, iquery)
241 continue; 240 continue;
242 } 241 }
243 242
244 if (n != host.h_length) { 243 if (haveanswer) {
245 cp += n; 244 if (n != host.h_length) {
246 continue; 245 cp += n;
247 } 246 continue;
248 if (class != getclass) { 247 }
249 cp += n; 248 if (class != getclass) {
250 continue; 249 cp += n;
251 } 250 continue;
252 if (!haveanswer) { 251 }
252 } else {
253 host.h_length = n;
253 getclass = class; 254 getclass = class;
254 host.h_addrtype = (class == C_IN) ? AF_INET : AF_UNSPEC; 255 host.h_addrtype = (class == C_IN) ? AF_INET : AF_UNSPEC;
256 if (host.h_addrtype == AF_INET)
257 host.h_length = INADDRSZ;
255 if (!iquery) { 258 if (!iquery) {
256 host.h_name = bp; 259 host.h_name = bp;
257 bp += strlen(bp) + 1; 260 bp += strlen(bp) + 1;