tail: seek to EOF to check if seekable. fixes tail on /proc files
This commit is contained in:
parent
f4f2ff6038
commit
1c835e370f
|
@ -365,17 +365,8 @@ usage(void)
|
||||||
exits("usage");
|
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
|
static int
|
||||||
isseekable(int fd)
|
isseekable(int fd)
|
||||||
{
|
{
|
||||||
vlong m;
|
return seek(fd, 0, 2) > 0 && seek(fd, 0, 0) == 0;
|
||||||
|
|
||||||
m = seek(fd, 0, 1);
|
|
||||||
if(m < 0)
|
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue