ref: 4affc9c543402364ccbf533576b017957451ec81
parent: 6760188a44a5165a7de76fa7a5fe37f2450a198c
author: ftrvxmtrx <devnull@localhost>
date: Thu May 8 10:29:44 EDT 2014
tail: fix follow for empty files (thanks cinap_lenrek)
--- a/sys/src/cmd/tail.c
+++ b/sys/src/cmd/tail.c
@@ -8,6 +8,7 @@
* the simple command tail -c, legal in v10, is illegal
*/
+vlong fend;
long count;
int anycount;
int follow;
@@ -111,7 +112,7 @@
else
if(units==LINES && origin==BEG)
skip();
- if(follow && seekable)
+ if(follow && (seekable || fend == 0))
for(;;) {static Dir *sb0, *sb1;
trunc(sb1, &sb0);
@@ -368,5 +369,6 @@
static int
isseekable(int fd)
{- return seek(fd, 0, 2) > 0 && seek(fd, 0, 0) == 0;
+ fend = seek(fd, 0, 2);
+ return fend > 0 && seek(fd, 0, 0) == 0;
}
--
⑨