aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-08-09 10:49:44 +0800
committerPo Lu2023-08-09 10:49:44 +0800
commit4767f5eaeedef57dfcc119399e5855f41c2e1be5 (patch)
tree54bf5b93665df13f4b57eb9b084d7446eea08493 /src
parentdd1d8414b33fe620cf21361a4f089d5f14ff454c (diff)
downloademacs-4767f5eaeedef57dfcc119399e5855f41c2e1be5.tar.gz
emacs-4767f5eaeedef57dfcc119399e5855f41c2e1be5.zip
Better fix for bug#65156
* src/fileio.c (Finsert_file_contents): Correct seek-ability test, since lseek returns -1 upon failure. (Bug#65156)
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c6
1 files 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. */)
4023 if (!S_ISREG (st.st_mode)) 4023 if (!S_ISREG (st.st_mode))
4024 { 4024 {
4025 regular = false; 4025 regular = false;
4026 seekable = lseek (fd, 0, SEEK_CUR) < 0; 4026 seekable = lseek (fd, 0, SEEK_CUR) != (off_t) -1;
4027 4027
4028 if (! NILP (visit)) 4028 if (! NILP (visit))
4029 { 4029 {
@@ -4581,7 +4581,7 @@ by calling `format-decode', which see. */)
4581 goto handled; 4581 goto handled;
4582 } 4582 }
4583 4583
4584 if ((seekable && regular) || !NILP (end)) 4584 if (seekable || !NILP (end))
4585 total = end_offset - beg_offset; 4585 total = end_offset - beg_offset;
4586 else 4586 else
4587 /* For a special file, all we can do is guess. */ 4587 /* For a special file, all we can do is guess. */
@@ -4678,7 +4678,7 @@ by calling `format-decode', which see. */)
4678 For a special file, where TOTAL is just a buffer size, 4678 For a special file, where TOTAL is just a buffer size,
4679 so don't bother counting in HOW_MUCH. 4679 so don't bother counting in HOW_MUCH.
4680 (INSERTED is where we count the number of characters inserted.) */ 4680 (INSERTED is where we count the number of characters inserted.) */
4681 if ((seekable && regular) || !NILP (end)) 4681 if (seekable || !NILP (end))
4682 how_much += this; 4682 how_much += this;
4683 inserted += this; 4683 inserted += this;
4684 } 4684 }