summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-04-18 15:34:35 +0000
committerGerd Moellmann <gerd@gnu.org>2001-04-18 15:34:35 +0000
commitd21dd12d90f94e86ef67d27abe1c20b2df06fc05 (patch)
tree058fed89150bd0e3d6dc1367e5adf419b2dba20e /src
parent6f26dfa51fa6a9308fbfc815e8bd1742180b8bc3 (diff)
downloademacs-d21dd12d90f94e86ef67d27abe1c20b2df06fc05.tar.gz
(Finsert_file_contents): If the file size returned from
stat is zero, set END to READ_BUF_SIZE. This makes sure we can read from files on a procfs whose contents are generated dynamically.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 84a0c6c625c..8b6c0bd165a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3589,6 +3589,12 @@ actually used.")
if (XINT (end) != st.st_size
|| ((int) st.st_size * 4) / 4 != st.st_size)
error ("Maximum buffer size exceeded");
+
+ /* The file size returned from stat may be zero, but data
+ may be readable nonetheless, for example when this is a
+ file in the /proc filesystem. */
+ if (st.st_size == 0)
+ XSETINT (end, READ_BUF_SIZE);
}
}