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

conf/51256: chkgrp should make sure the file is newline terminated



On Tue, May 27, 2003 at 11:55:25PM +1000, Tim Robbins wrote:
> On Tue, May 27, 2003 at 11:42:42AM +0300, Peter Pentchev wrote:
> 
> > Could somebody take a look at this PR and the patch (quoted below), and
> > see if there's anything wrong with it or it may be committed?
> [...]
> > >   	if ((line = fgetln(gf, &len)) == NULL)
> > >   	    break;
> > >  +	if (len > 0 && line[len - 1] != '\n' && line[len - 1] != '\r') {
> > >  +	    warnx("%s: line %d: no newline character", gfn, n);
> > >  +	    e++;
> > >  +	}
> [...]
> 
> I think that it's unnecessary (and incorrect) to check for a '\r' character
> at the end of the line.

Okay, this might have been a bad habit of processing files that came
from Over There ;)  So.. how about the patch with only the '\n' check,
then?

G'luck,
Peter

-- 
Peter Pentchev	roam_(_at_)_ringlet_(_dot_)_net    roam_(_at_)_sbnd_(_dot_)_net    roam_(_at_)_FreeBSD_(_dot_)_org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
I am not the subject of this sentence.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-audit/attachments/20030527/18d39356/attachment.bin

Visit your host, monkey.org