diff options
author | ume <ume@FreeBSD.org> | 2005-04-24 18:22:39 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2005-04-24 18:22:39 +0000 |
commit | 02df93e077f8ce629aecf120a2818da87e1ebc28 (patch) | |
tree | 9c2b38a011f6fe3e2827844a62e68eea39ad374e /lib/libc/net | |
parent | 05a8bcf8e714db1f4dd7a663fdce919d1c2bfed6 (diff) | |
download | FreeBSD-src-02df93e077f8ce629aecf120a2818da87e1ebc28.zip FreeBSD-src-02df93e077f8ce629aecf120a2818da87e1ebc28.tar.gz |
if last line didn't have trailing space, network address was also
treated as an alias.
Diffstat (limited to 'lib/libc/net')
-rw-r--r-- | lib/libc/net/getnetbyht.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/libc/net/getnetbyht.c b/lib/libc/net/getnetbyht.c index f536422..2aeb706 100644 --- a/lib/libc/net/getnetbyht.c +++ b/lib/libc/net/getnetbyht.c @@ -120,18 +120,19 @@ again: net.n_net = inet_network(cp); net.n_addrtype = AF_INET; q = net.n_aliases = net_aliases; - if (p != NULL) + if (p != NULL) { cp = p; - while (cp && *cp) { - if (*cp == ' ' || *cp == '\t') { - cp++; - continue; + while (cp && *cp) { + if (*cp == ' ' || *cp == '\t') { + cp++; + continue; + } + if (q < &net_aliases[MAXALIASES - 1]) + *q++ = cp; + cp = strpbrk(cp, " \t"); + if (cp != NULL) + *cp++ = '\0'; } - if (q < &net_aliases[MAXALIASES - 1]) - *q++ = cp; - cp = strpbrk(cp, " \t"); - if (cp != NULL) - *cp++ = '\0'; } *q = NULL; return (&net); |