aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Branco <rbranco@suse.de>2024-01-05 19:42:00 +0000
committerXin LI <delphij@FreeBSD.org>2024-04-24 05:27:06 +0000
commite8ec4b5d1202d935bcc6ed75c361b618e8da627f (patch)
tree6d2620de302f35ebdb6aa2aac2713ae01f3fb21a
parent448d114b25157a4bcc2463e584fae6bdae42fa37 (diff)
downloadsrc-vendor/less.tar.gz
src-vendor/less.zip
less: Do not trust st_size if it equals zerovendor/less
-rw-r--r--ch.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/ch.c b/ch.c
index fd53b2d66e38..51045438a296 100644
--- a/ch.c
+++ b/ch.c
@@ -700,7 +700,6 @@ public void ch_flush(void)
ch_block = 0; /* ch_fpos / LBUFSIZE; */
ch_offset = 0; /* ch_fpos % LBUFSIZE; */
-#if HAVE_PROCFS
/*
* This is a kludge to workaround a Linux kernel bug: files in
* /proc have a size of 0 according to fstat() but have readable
@@ -709,17 +708,9 @@ public void ch_flush(void)
*/
if (ch_fsize == 0)
{
- struct statfs st;
- if (fstatfs(ch_file, &st) == 0)
- {
- if (st.f_type == PROC_SUPER_MAGIC)
- {
- ch_fsize = NULL_POSITION;
- ch_flags &= ~CH_CANSEEK;
- }
- }
+ ch_fsize = NULL_POSITION;
+ ch_flags &= ~CH_CANSEEK;
}
-#endif
if (lseek(ch_file, (off_t)0, SEEK_SET) == BAD_LSEEK)
{