emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 4767f5eaeed: Better fix for bug#65156


From: Po Lu
Subject: emacs-29 4767f5eaeed: Better fix for bug#65156
Date: Tue, 8 Aug 2023 22:50:07 -0400 (EDT)

branch: emacs-29
commit 4767f5eaeedef57dfcc119399e5855f41c2e1be5
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Better fix for bug#65156
    
    * src/fileio.c (Finsert_file_contents): Correct seek-ability
    test, since lseek returns -1 upon failure.  (Bug#65156)
---
 src/fileio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/fileio.c b/src/fileio.c
index 55132f1ec38..4d5365bff9a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4023,7 +4023,7 @@ by calling `format-decode', which see.  */)
   if (!S_ISREG (st.st_mode))
     {
       regular = false;
-      seekable = lseek (fd, 0, SEEK_CUR) < 0;
+      seekable = lseek (fd, 0, SEEK_CUR) != (off_t) -1;
 
       if (! NILP (visit))
         {
@@ -4581,7 +4581,7 @@ by calling `format-decode', which see.  */)
       goto handled;
     }
 
-  if ((seekable && regular) || !NILP (end))
+  if (seekable || !NILP (end))
     total = end_offset - beg_offset;
   else
     /* For a special file, all we can do is guess.  */
@@ -4678,7 +4678,7 @@ by calling `format-decode', which see.  */)
           For a special file, where TOTAL is just a buffer size,
           so don't bother counting in HOW_MUCH.
           (INSERTED is where we count the number of characters inserted.)  */
-       if ((seekable && regular) || !NILP (end))
+       if (seekable || !NILP (end))
          how_much += this;
        inserted += this;
       }



reply via email to

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