From 330bc8582df629e9fa4dccb68bbab181520d98a9 Mon Sep 17 00:00:00 2001 From: brian Date: Fri, 5 Jun 2009 09:08:53 +0000 Subject: Change the behaviour of -F slightly; it now persists (forever) in trying to open files rather than giving up when it encounters an error. ENOENT errors are not reported. As a result, files that are moved away then recreated are not at risk of being 'lost' to tail. Files that are recreated and temporarily have unreadable permissions will be shown when they are fixed. This behaviour is consistent with the GNU version of tail but without the verbiage that goes with the GNU version. This change also fixes error messages accompanying -f and -F. They no longer report problems with (null)! MFC after: 3 weeks --- usr.bin/tail/read.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'usr.bin/tail/read.c') diff --git a/usr.bin/tail/read.c b/usr.bin/tail/read.c index d290ed4..14086e7 100644 --- a/usr.bin/tail/read.c +++ b/usr.bin/tail/read.c @@ -66,7 +66,7 @@ static const char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/6/93"; * the end. */ int -bytes(FILE *fp, off_t off) +bytes(FILE *fp, const char *fn, off_t off) { int ch, len, tlen; char *ep, *p, *t; @@ -84,7 +84,7 @@ bytes(FILE *fp, off_t off) } } if (ferror(fp)) { - ierr(); + ierr(fn); free(sp); return 1; } @@ -136,7 +136,7 @@ bytes(FILE *fp, off_t off) * the end. */ int -lines(FILE *fp, off_t off) +lines(FILE *fp, const char *fn, off_t off) { struct { int blen; @@ -178,7 +178,7 @@ lines(FILE *fp, off_t off) } } if (ferror(fp)) { - ierr(); + ierr(fn); rc = 1; goto done; } -- cgit v1.1