summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroam <roam@FreeBSD.org>2003-06-06 07:10:39 +0000
committerroam <roam@FreeBSD.org>2003-06-06 07:10:39 +0000
commit81c0c117b3d75a99ffc1a063a1664381b977504e (patch)
tree6dcb64bbab5b1fbbfe08bbe81b02779e716d05a4
parent0ef5e36b574dab2fd87c4c918f91e0e6eab66334 (diff)
downloadFreeBSD-src-81c0c117b3d75a99ffc1a063a1664381b977504e.zip
FreeBSD-src-81c0c117b3d75a99ffc1a063a1664381b977504e.tar.gz
Warn if there is no newline at the end of the group file.
PR: 51256 Submitted by: Brian D Gallaway <bdg730@makserver0.usask.ca> Reviewed by: tjr, -audit Approved by: tjr
-rw-r--r--usr.sbin/chkgrp/chkgrp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.sbin/chkgrp/chkgrp.c b/usr.sbin/chkgrp/chkgrp.c
index ef1fbe2..f448dae 100644
--- a/usr.sbin/chkgrp/chkgrp.c
+++ b/usr.sbin/chkgrp/chkgrp.c
@@ -74,6 +74,10 @@ main(int argc, char *argv[])
while (++n) {
if ((line = fgetln(gf, &len)) == NULL)
break;
+ if (len > 0 && line[len - 1] != '\n') {
+ warnx("%s: line %d: no newline character", gfn, n);
+ e++;
+ }
while (len && isspace(line[len-1]))
len--;
OpenPOWER on IntegriCloud