diff options
author | sobomax <sobomax@FreeBSD.org> | 2005-01-03 11:07:45 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2005-01-03 11:07:45 +0000 |
commit | 742d1c9a2deef3e3a8c55e763a1e8c2e46b2becb (patch) | |
tree | 932dc5516fad9adc5c8df459d8e23846159bce61 | |
parent | 4bf9384dba041617b5b6f2757dd817023110f50f (diff) | |
download | FreeBSD-src-742d1c9a2deef3e3a8c55e763a1e8c2e46b2becb.zip FreeBSD-src-742d1c9a2deef3e3a8c55e763a1e8c2e46b2becb.tar.gz |
Don't ignore the last line of config file (/etc/hosts, /etc/services, etc)
which doesn't end in \n, since it may be very confusing. Also this should
increase consistency, since most other config files work just fine regardless
of the presence of traling \n in the last line.
MFC After: 2 weeks
-rw-r--r-- | lib/libc/net/getaddrinfo.c | 6 | ||||
-rw-r--r-- | lib/libc/net/gethostbyht.c | 6 | ||||
-rw-r--r-- | lib/libc/net/getnetbyht.c | 5 | ||||
-rw-r--r-- | lib/libc/net/getprotoent.c | 5 | ||||
-rw-r--r-- | lib/libc/net/getservent.c | 5 |
5 files changed, 12 insertions, 15 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index 6508024..9c4948e 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -2070,9 +2070,9 @@ again: return (NULL); if (*p == '#') goto again; - if (!(cp = strpbrk(p, "#\n"))) - goto again; - *cp = '\0'; + cp = strpbrk(p, "#\n"); + if (cp != NULL) + *cp = '\0'; if (!(cp = strpbrk(p, " \t"))) goto again; *cp++ = '\0'; diff --git a/lib/libc/net/gethostbyht.c b/lib/libc/net/gethostbyht.c index e4320fd..e414058 100644 --- a/lib/libc/net/gethostbyht.c +++ b/lib/libc/net/gethostbyht.c @@ -118,9 +118,9 @@ gethostent() } if (*p == '#') goto again; - if (!(cp = strpbrk(p, "#\n"))) - goto again; - *cp = '\0'; + cp = strpbrk(p, "#\n"); + if (cp != NULL) + *cp = '\0'; if (!(cp = strpbrk(p, " \t"))) goto again; *cp++ = '\0'; diff --git a/lib/libc/net/getnetbyht.c b/lib/libc/net/getnetbyht.c index 6eaebc5..f536422 100644 --- a/lib/libc/net/getnetbyht.c +++ b/lib/libc/net/getnetbyht.c @@ -105,9 +105,8 @@ again: if (*p == '#') goto again; cp = strpbrk(p, "#\n"); - if (cp == NULL) - goto again; - *cp = '\0'; + if (cp != NULL) + *cp = '\0'; net.n_name = p; cp = strpbrk(p, " \t"); if (cp == NULL) diff --git a/lib/libc/net/getprotoent.c b/lib/libc/net/getprotoent.c index c8f1ad4..e2d7a97 100644 --- a/lib/libc/net/getprotoent.c +++ b/lib/libc/net/getprotoent.c @@ -87,9 +87,8 @@ again: if (*p == '#') goto again; cp = strpbrk(p, "#\n"); - if (cp == NULL) - goto again; - *cp = '\0'; + if (cp != NULL) + *cp = '\0'; proto.p_name = p; cp = strpbrk(p, " \t"); if (cp == NULL) diff --git a/lib/libc/net/getservent.c b/lib/libc/net/getservent.c index a89bc51..7e44235 100644 --- a/lib/libc/net/getservent.c +++ b/lib/libc/net/getservent.c @@ -244,9 +244,8 @@ unpack: if (*p == '#') goto again; cp = strpbrk(p, "#\n"); - if (cp == NULL) - goto again; - *cp = '\0'; + if (cp != NULL) + *cp = '\0'; serv.s_name = p; p = strpbrk(p, " \t"); if (p == NULL) |