Fix visiting files in /proc/ directory

* src/fileio.c (Finsert_file_contents): Treat regular files whose
size is reported as zero as if they were special files.  (Bug#75569)
This commit is contained in:
Eli Zaretskii 2025-01-19 12:51:18 +02:00
parent 40a8d0ebf0
commit 26c9fbc94d

View file

@ -4747,10 +4747,11 @@ by calling `format-decode', which see. */)
goto handled;
}
if (seekable || !NILP (end))
/* Don't believe st.st_size if it is zero. */
if ((regular && st.st_size > 0) || (!regular && seekable) || !NILP (end))
total = end_offset - beg_offset;
else
/* For a special file, all we can do is guess. */
/* For a special file that is not seekable, all we can do is guess. */
total = READ_BUF_SIZE;
if (NILP (visit) && total > 0)