aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Branco <rbranco@suse.de>2024-04-24 05:29:46 +0000
committerXin LI <delphij@FreeBSD.org>2024-04-27 07:08:17 +0000
commit302d0acea8a0bc18a26b5e0f1a7870b09dc58d16 (patch)
tree0c8355ce54970ca8c21b92eb29af68130c06070c
parent5da0bdbf28b11db13b8b728ef1dda1dbe4fac50f (diff)
downloadsrc-stable/13.tar.gz
src-stable/13.zip
MFV: less: Do not trust st_size if it equals zerostable/13
This is a smaller version of upstream 1fafd968b48e5cea6c85f126d77071a8de707a55 to address the issue that less not being able to operate on files residing in pseudo-filesystems that advertize a zero size value. PR: bin/276133 (cherry picked from commit cae336280b0d7ad3d49788c5fc0986f91328eb50)
-rw-r--r--contrib/less/ch.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/contrib/less/ch.c b/contrib/less/ch.c
index fd53b2d66e38..51045438a296 100644
--- a/contrib/less/ch.c
+++ b/contrib/less/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)
{