NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/48926: gethostbyname(3) doesn't appear to work under NetBSD-5.2 and NetBSD-6.1.x when hostnames appear only in /etc/hosts
The following reply was made to PR lib/48926; it has been noted by GNATS.
From: Brian Buhrow <buhrow%nfbcal.org@localhost>
To: gnats-bugs%NetBSD.org@localhost, lib-bug-people%NetBSD.org@localhost,
gnats-admin%NetBSD.org@localhost,
netbsd-bugs%NetBSD.org@localhost
Cc: buhrow%nfbcal.org@localhost
Subject: Re: lib/48926: gethostbyname(3) doesn't appear to work under
NetBSD-5.2 and NetBSD-6.1.x when hostnames appear only in /etc/hosts
Date: Mon, 23 Jun 2014 08:09:43 -0700
hello. I should know never to submit the first working patch as the
final version. This one is much simpler and solves the problem much more
elegantly.
-thanks
-Brian
Index: gethnamaddr.c
===================================================================
RCS file: /cvsroot/src/lib/libc/net/gethnamaddr.c,v
retrieving revision 1.73.18.3
diff -u -r1.73.18.3 gethnamaddr.c
--- gethnamaddr.c 23 Dec 2013 23:12:44 -0000 1.73.18.3
+++ gethnamaddr.c 23 Jun 2014 14:46:25 -0000
@@ -742,10 +742,9 @@
goto again;
if (*p == '#')
goto again;
- p[llen] = '\0';
- if (!(cp = strpbrk(p, "#\n")))
- goto again;
- *cp = '\0';
+ p[llen - 1] = '\0';
+ if (cp = strpbrk(p, "#"))
+ *cp = '\0';
if (!(cp = strpbrk(p, " \t")))
goto again;
*cp++ = '\0';
Home |
Main Index |
Thread Index |
Old Index