ref: 6760188a44a5165a7de76fa7a5fe37f2450a198c
parent: e426ecc47856cc726e6e1f7445ca45bd3866c75c
author: ftrvxmtrx <devnull@localhost>
date: Thu May 8 08:33:24 EDT 2014
tail: seek to EOF to check if seekable. fixes tail on /proc files
--- a/sys/src/cmd/tail.c
+++ b/sys/src/cmd/tail.c
@@ -365,17 +365,8 @@
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;
}
--
⑨