summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-27 18:50:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-27 18:50:05 +0000
commitb44a616ea5c66f88ef4bccbb7583afc03acb4c33 (patch)
treed12b1ac808496678d89e13b7f8109401622b9bdc
parent500a7315cb75c74261644cda1df67202fe8d52b4 (diff)
more INADDRSZ pedantry
-rw-r--r--lib/libc/net/gethostnamadr.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c
index 3830e52cc64..c9220e1cf67 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.10 1996/09/27 18:37:11 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: gethostnamadr.c,v 1.11 1996/09/27 18:50:04 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -171,6 +171,7 @@ 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';
@@ -240,21 +241,17 @@ getanswer(answer, anslen, iquery)
continue;
}
- if (haveanswer) {
- if (n != host.h_length) {
- cp += n;
- continue;
- }
- if (class != getclass) {
- cp += n;
- continue;
- }
- } else {
- host.h_length = n;
+ if (n != host.h_length) {
+ cp += n;
+ continue;
+ }
+ if (class != getclass) {
+ cp += n;
+ continue;
+ }
+ if (!haveanswer) {
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;