]> git.eshelyaron.com Git - emacs.git/commit
insert-file-contents file end EOF fixes
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 12 Jul 2025 21:31:18 +0000 (14:31 -0700)
committerEshel Yaron <me@eshelyaron.com>
Thu, 24 Jul 2025 08:48:47 +0000 (10:48 +0200)
commitfe763ca0c1a55316ba7f9f25ad2e0a242c487d41
tree406b5bf94066d761e8e740911cd098ca959a9d5f
parentbffd24a73685d091132763a6995536d396ddaa2a
insert-file-contents file end EOF fixes

* src/fileio.c (Finsert_file_contents):
When counting bytes at file end, don’t trust lseek to seek
to the end of the file.  Instead, read a bit after lseeking,
to make sure we get to the end, give up if we don’t get to EOF.
This works around problems on /proc filesystems
where lseek pretends the file is empty.
Update file_size_hint when reaching EOF.

(cherry picked from commit aee9b598312e282700c4eedf02b174b908479ce7)
src/fileio.c