From: Jim Meyering Date: Mon, 24 Oct 2005 16:07:36 +0000 (+0000) Subject: (tac_file): When determining whether a file is seekable, X-Git-Tag: v6.0~1463 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91795f6fa29eac96e3a18d1c2198c66f3fca364a;p=thirdparty%2Fcoreutils.git (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. --- diff --git a/src/tac.c b/src/tac.c index c5fbe24e6a..0b68a0ef3d 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) {