]> git.eshelyaron.com Git - emacs.git/commit
Don’t trust st_size when scanning file head+tail
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 22 Jan 2025 19:06:06 +0000 (11:06 -0800)
committerEshel Yaron <me@eshelyaron.com>
Thu, 24 Jul 2025 08:47:23 +0000 (10:47 +0200)
commit927356af6c6c58e8084018fac2188bb9a3d4f401
tree293000f21caadbcbb80b7265ee96c816129fdb12
parent65bd9993a796b29220c09746b7319379b018d895
Don’t trust st_size when scanning file head+tail

* src/fileio.c (Finsert_file_contents): Do not look at st_size
when scanning the file’s head and tail for a coding system comment.
Instead, just use read and SEEK_END and don’t worry if the latter fails.
st_size and lseek might not work in a /proc file system.

(cherry picked from commit 0a3c8a4df3f9e15737e4e5b4aecd2e63d2abbc4f)
src/fileio.c