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
This commit is contained in:
parent
a8ef988f65
commit
7b6cc40479
@ -2070,9 +2070,9 @@ _gethtent(name, pai)
|
||||
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';
|
||||
|
@ -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';
|
||||
|
@ -105,9 +105,8 @@ getnetent()
|
||||
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)
|
||||
|
@ -87,9 +87,8 @@ getprotoent()
|
||||
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)
|
||||
|
@ -244,9 +244,8 @@ getservent()
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user