emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ccc0921151 3/5: Don’t scan text twice to guess coding system


From: Paul Eggert
Subject: master ccc0921151 3/5: Don’t scan text twice to guess coding system
Date: Mon, 13 Feb 2023 15:33:07 -0500 (EST)

branch: master
commit ccc092115172f15c9135771f90d0000f8bf21614
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Don’t scan text twice to guess coding system
    
    * src/fileio.c (Finsert_file_contents): If the file shrank
    below 4 KiB, don’t read duplicate text into READ_BUF.
    This also removes a use of SEEK_END, which Linux /proc
    file systems do not support (not that we should get here
    with /proc).
---
 src/fileio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/fileio.c b/src/fileio.c
index 751b8ec573..47177be0f4 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4119,7 +4119,7 @@ by calling `format-decode', which see.  */)
                  if (nread == 1024)
                    {
                      int ntail;
-                     if (lseek (fd, - (1024 * 3), SEEK_END) < 0)
+                     if (lseek (fd, st.st_size - 1024 * 3, SEEK_CUR) < 0)
                        report_file_error ("Setting file position",
                                           orig_filename);
                      ntail = emacs_read_quit (fd, read_buf + nread, 1024 * 3);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]