aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2024-02-17 10:27:26 +0800
committerPo Lu2024-02-17 10:27:26 +0800
commit5b65c2ad7526ec081ac37d32c87e9b58e787d66a (patch)
tree8d2bfa0c42171ffd3e72638137e6eb124a26ab7c
parent4b89fb08bdd7d0249698bc0ed578555d6755724d (diff)
downloademacs-5b65c2ad7526ec081ac37d32c87e9b58e787d66a.tar.gz
emacs-5b65c2ad7526ec081ac37d32c87e9b58e787d66a.zip
Properly record mtime after insert-file-contents on Android
* src/fileio.c (write_region): Do not verify file identity after retreiving file status for the second time if st_ino is 0.
-rw-r--r--src/fileio.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c
index a92da93ae48..483498fd879 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5628,7 +5628,15 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
5628 changed to a call to `stat'. */ 5628 changed to a call to `stat'. */
5629 5629
5630 if (emacs_fstatat (AT_FDCWD, fn, &st1, 0) == 0 5630 if (emacs_fstatat (AT_FDCWD, fn, &st1, 0) == 0
5631 && st.st_dev == st1.st_dev && st.st_ino == st1.st_ino) 5631 && st.st_dev == st1.st_dev
5632 && (st.st_ino == st1.st_ino
5633#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
5634 /* `st1.st_ino' == 0 indicates that the inode number
5635 cannot be extracted from this document file, despite
5636 `st' potentially being backed by a real file. */
5637 || st1.st_ino == 0
5638#endif /* defined HAVE_ANDROID && !defined ANDROID_STUBIFY */
5639 ))
5632 { 5640 {
5633 /* Use the heuristic if it appears to be valid. With neither 5641 /* Use the heuristic if it appears to be valid. With neither
5634 O_EXCL nor O_TRUNC, if Emacs happened to write nothing to the 5642 O_EXCL nor O_TRUNC, if Emacs happened to write nothing to the