summaryrefslogtreecommitdiff
path: root/src/tac.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-10-24 16:07:36 +0000
committerJim Meyering <jim@meyering.net>2005-10-24 16:07:36 +0000
commit91795f6fa29eac96e3a18d1c2198c66f3fca364a (patch)
tree19b919ae1d8f2e97e306eaff8f8b0c45bd6727f8 /src/tac.c
parentb9165cb37310af00f12be6b814dc97cd194c5107 (diff)
downloadcoreutils-91795f6fa29eac96e3a18d1c2198c66f3fca364a.tar.xz
(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.
Diffstat (limited to 'src/tac.c')
-rw-r--r--src/tac.c6
1 files changed, 3 insertions, 3 deletions
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)
{