summaryrefslogtreecommitdiff
path: root/sys/src/cmd/tail.c
diff options
context:
space:
mode:
authorftrvxmtrx <devnull@localhost>2014-05-08 12:33:24 +0200
committerftrvxmtrx <devnull@localhost>2014-05-08 12:33:24 +0200
commit1c835e370ff58e58b75c12a9e743a2bb33d84cb0 (patch)
tree0144de1d920a2f99d11563a9f63bc704d07d06fc /sys/src/cmd/tail.c
parentf4f2ff6038f47f73775ccc58cd31985d7f169bdc (diff)
tail: seek to EOF to check if seekable. fixes tail on /proc files
Diffstat (limited to 'sys/src/cmd/tail.c')
-rw-r--r--sys/src/cmd/tail.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/sys/src/cmd/tail.c b/sys/src/cmd/tail.c
index 5f328af69..572224749 100644
--- a/sys/src/cmd/tail.c
+++ b/sys/src/cmd/tail.c
@@ -365,17 +365,8 @@ usage(void)
exits("usage");
}
-/* return true if seeks work and if the file is > 0 length.
- * this will eventually bite me in the ass if seeking a file
- * is not conservative. - presotto
- */
static int
isseekable(int fd)
-{
- vlong m;
-
- m = seek(fd, 0, 1);
- if(m < 0)
- return 0;
- return 1;
+{
+ return seek(fd, 0, 2) > 0 && seek(fd, 0, 0) == 0;
}