[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#453899: ether_line returns far too much



On Sun, Dec 02, 2007 at 10:15:16AM -0500, Clint Adams wrote:
> On Sat, Dec 01, 2007 at 09:49:23PM -0700, Matthew Wilcox wrote:
> >         const char *ethers = mmap(NULL, 100000, PROT_READ, MAP_SHARED, fd, 0);
> > 
> >         ether_line(ethers, &addr, hostname);
> 
> Is there a reason to pass more than one actual line to ether_line()?

Um, I think I just showed an example -- where you want to mmap /etc/ethers
rather than fgets() each line in turn.  Is that a usage that we don't want
to support?  If so, I think the manpage should be amended to state that.

It's somewhat ambiguous, of course:

       The ether_line() function parses a line in /etc/ethers format (ethernet
       address followed by whitespace followed by hostname; '#' introduces  a
       comment)  and  returns  an address and hostname pair, or non-zero if it
       cannot be parsed.  The buffer pointed to by  hostname  must  be  suffi-
       ciently long, for example, have the same length as line.

It doesn't say the line has to be NUL-terminated; my understanding would
be that a \n terminates a line.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."




Reply to: