]> git.eshelyaron.com Git - emacs.git/commitdiff
(Finsert_file_contents): If the file size returned from
authorGerd Moellmann <gerd@gnu.org>
Wed, 18 Apr 2001 15:34:35 +0000 (15:34 +0000)
committerGerd Moellmann <gerd@gnu.org>
Wed, 18 Apr 2001 15:34:35 +0000 (15:34 +0000)
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.

src/fileio.c

index 84a0c6c625cb39d31a45ed8b88bc94a3672266fc..8b6c0bd165a9afe37e6ead81f948ab4f47376f84 100644 (file)
@@ -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);
        }
     }