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



        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