diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2000-11-21 22:01:49 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2000-11-21 22:01:49 +0000 |
commit | f246c01cf1eb026400003bb5689e4d812bd0cab5 (patch) | |
tree | fbc4fb55aff1eed672d12971c42425de25b4bde2 /usr.bin/tail | |
parent | 94de05185b93d013f30d8874f4fea920b09ed369 (diff) |
When doing tail -f from stdin don't reopen a local file named stdin.
Diffstat (limited to 'usr.bin/tail')
-rw-r--r-- | usr.bin/tail/extern.h | 3 | ||||
-rw-r--r-- | usr.bin/tail/forward.c | 6 | ||||
-rw-r--r-- | usr.bin/tail/tail.c | 6 |
3 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/tail/extern.h b/usr.bin/tail/extern.h index 983ca7f3deb..a35a4fb93af 100644 --- a/usr.bin/tail/extern.h +++ b/usr.bin/tail/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.5 2000/06/23 17:04:46 ericj Exp $ */ +/* $OpenBSD: extern.h,v 1.6 2000/11/21 22:01:47 art Exp $ */ /* $NetBSD: extern.h,v 1.3 1994/11/23 07:42:00 jtc Exp $ */ /*- @@ -53,3 +53,4 @@ void oerr __P((void)); extern int fflag, rflag, rval; extern char *fname; +extern int is_stdin;
\ No newline at end of file diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c index 9235c9274b0..714efa7de5f 100644 --- a/usr.bin/tail/forward.c +++ b/usr.bin/tail/forward.c @@ -1,4 +1,4 @@ -/* $OpenBSD: forward.c,v 1.10 2000/10/12 10:18:38 art Exp $ */ +/* $OpenBSD: forward.c,v 1.11 2000/11/21 22:01:47 art Exp $ */ /* $NetBSD: forward.c,v 1.7 1996/02/13 16:49:10 ghudson Exp $ */ /*- @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)forward.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: forward.c,v 1.10 2000/10/12 10:18:38 art Exp $"; +static char rcsid[] = "$OpenBSD: forward.c,v 1.11 2000/11/21 22:01:47 art Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -184,7 +184,7 @@ forward(fp, style, off, sbp) sleep(1); clearerr(fp); - if (stat(fname, &nsb) != 0) + if (is_stdin || stat(fname, &nsb) != 0) continue; /* Reopen file if the inode changes or file was truncated */ if (nsb.st_ino != sbp->st_ino) { diff --git a/usr.bin/tail/tail.c b/usr.bin/tail/tail.c index 8aae71e370c..8531fca1063 100644 --- a/usr.bin/tail/tail.c +++ b/usr.bin/tail/tail.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tail.c,v 1.5 1999/02/03 02:09:30 millert Exp $ */ +/* $OpenBSD: tail.c,v 1.6 2000/11/21 22:01:48 art Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -46,7 +46,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)tail.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: tail.c,v 1.5 1999/02/03 02:09:30 millert Exp $"; +static char rcsid[] = "$OpenBSD: tail.c,v 1.6 2000/11/21 22:01:48 art Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -63,6 +63,7 @@ static char rcsid[] = "$OpenBSD: tail.c,v 1.5 1999/02/03 02:09:30 millert Exp $" int fflag, rflag, rval; char *fname; +int is_stdin; static void obsolete __P((char **)); static void usage __P((void)); @@ -190,6 +191,7 @@ main(argc, argv) } else { fname = "stdin"; + is_stdin = 1; if (fstat(fileno(stdin), &sb)) { ierr(); |