From 91795f6fa29eac96e3a18d1c2198c66f3fca364a Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 24 Oct 2005 16:07:36 +0000 Subject: (tac_file): When determining whether a file is seekable, also test whether it is a tty. Using only the lseek-based test would give a false positive on Solaris. Reported by Peter Fales. --- src/tac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tac.c b/src/tac.c index c5fbe24e6..0b68a0ef3 100644 --- a/src/tac.c +++ b/src/tac.c @@ -547,9 +547,9 @@ tac_file (const char *filename) file_size = lseek (fd, (off_t) 0, SEEK_END); - ok = (0 <= file_size - ? tac_seekable (fd, filename) - : tac_nonseekable (fd, filename)); + ok = (file_size < 0 || isatty (fd) + ? tac_nonseekable (fd, filename) + : tac_seekable (fd, filename)); if (!is_stdin && close (fd) != 0) { -- cgit v1.2.3-70-g09d2