Should network aliases name be defaulted to network number?
Bjorn Eriksen
ber at enea.UUCP
Tue Jul 24 12:46:04 AEST 1984
Subject: Should network aliases name be defaulted to network number?
Index: /usr/src/lib/libc/getnetent.c 4.2BSD
Description:
When the network name data base file /etc/networks is read
with getnetent the aliases field is defaulted to the network
number. The manual page doesn't say it should, so I think
it's a bug.
Repeat-By:
Try the following and compare the two last columns (at least
for "simple" network numbers, otherwise p->n_net has to be
converted):
#include <netdb.h>
main()
{
register struct netent *p;
register char **cp;
setnetent(0);
while (p = getnetent()) {
printf("%s %d ", p->n_name, p->n_net);
for (cp = p->n_aliases; *cp != 0; cp++)
printf(" %s", *cp);
printf("\n");
}
endnetent();
}
Fix:
In getnetent.c just before the aliases field is beeing
extracted there are the lines
if ( p != NULL )
cp = p;
which will changes "cp" only if there really are any aliases.
Otherwise "cp" will still point to the network number, which
then will be set to the aliases name. Why not just remove
the "if" line?
--------
Bjorn Eriksen
ENEA DATA Sweden
UUCP: {decvax,philabs}!mcvax!enea!ber
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list