aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-02-01 12:51:12 -0800
committerPaul Eggert2013-02-01 12:51:12 -0800
commit35e854998e2ab2155875683411beb0518236da18 (patch)
tree21bff62f619f3f3568bed3d0ed3cc9727b53503d /src
parentaf314ba001f576c59dcc2df8506b34cdf12b5c63 (diff)
downloademacs-35e854998e2ab2155875683411beb0518236da18.tar.gz
emacs-35e854998e2ab2155875683411beb0518236da18.zip
Fix timestamp bug when write-region appends nothing.
* fileio.c (Fwrite_region): When neither O_EXCL nor O_TRUNC is used, the file's time stamp doesn't change if Emacs happens to write nothing to the file, and on a buggy file system this could cause Emacs to incorrectly infer that the file system doesn't have the bug. Avoid this problem by inhibiting the inference in this case. Fixes: debbugs:13149
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/fileio.c6
2 files changed, 14 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9682da24235..b4c3195973c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12013-02-01 Paul Eggert <eggert@cs.ucla.edu>
2
3 Fix timestamp bug when write-region appends nothing (Bug#13149).
4 * fileio.c (Fwrite_region): When neither O_EXCL nor O_TRUNC is used,
5 the file's time stamp doesn't change if Emacs happens to write nothing
6 to the file, and on a buggy file system this could cause Emacs to
7 incorrectly infer that the file system doesn't have the bug.
8 Avoid this problem by inhibiting the inference in this case.
9
12013-02-01 Dmitry Antipov <dmantipov@yandex.ru> 102013-02-01 Dmitry Antipov <dmantipov@yandex.ru>
2 11
3 * window.h (struct window): Convert base_line_number, base_line_pos 12 * window.h (struct window): Convert base_line_number, base_line_pos
diff --git a/src/fileio.c b/src/fileio.c
index a8218fcd797..fb6ecfedeb4 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5036,7 +5036,11 @@ This calls `write-region-annotate-functions' at the start, and
5036 && st.st_dev == st1.st_dev && st.st_ino == st1.st_ino) 5036 && st.st_dev == st1.st_dev && st.st_ino == st1.st_ino)
5037 { 5037 {
5038 EMACS_TIME modtime1 = get_stat_mtime (&st1); 5038 EMACS_TIME modtime1 = get_stat_mtime (&st1);
5039 if (EMACS_TIME_EQ (modtime, modtime1) 5039 /* If neither O_EXCL nor O_TRUNC is used, and Emacs happened to
5040 write nothing to the file, the file's time stamp won't change
5041 so it should not be used in this heuristic. */
5042 if ((open_flags & (O_EXCL | O_TRUNC)) != 0
5043 && EMACS_TIME_EQ (modtime, modtime1)
5040 && st.st_size == st1.st_size) 5044 && st.st_size == st1.st_size)
5041 { 5045 {
5042 timestamp_file_system = st.st_dev; 5046 timestamp_file_system = st.st_dev;