changeset 37390:2db1b1bb1d18

(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.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 18 Apr 2001 15:34:35 +0000
parents 3061b65a9897
children a8cdf6a9bab1
files src/fileio.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Wed Apr 18 15:09:36 2001 +0000
+++ b/src/fileio.c	Wed Apr 18 15:34:35 2001 +0000
@@ -3589,6 +3589,12 @@
 	  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);
 	}
     }