aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2002-03-09 00:38:54 +0000
committerJason Rumney2002-03-09 00:38:54 +0000
commitad497129bafbe28df203d8a5bc309daa6d2ae646 (patch)
treefdbea91491d57816d683f3a7140ef6c0518d3555 /src
parentf67acc8dfbd37fd8d7bb8ab34dbad942b5b32513 (diff)
downloademacs-ad497129bafbe28df203d8a5bc309daa6d2ae646.tar.gz
emacs-ad497129bafbe28df203d8a5bc309daa6d2ae646.zip
(Fcopy_file) [WINDOWS_NT]: Ensure file is not
read-only when setting modified time.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/fileio.c23
2 files changed, 23 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2864d8f1296..5ae6ce6ebf5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12002-03-09 Jason Rumney <jasonr@gnu.org>
2
3 * fileio.c (Fcopy_file) [WINDOWS_NT]: Ensure file is not
4 read-only when setting modified time.
5
12002-03-08 Gerd Moellmann <gerd@gnu.org> 62002-03-08 Gerd Moellmann <gerd@gnu.org>
2 7
3 * xdisp.c (move_it_vertically_backward): At the end of the 8 * xdisp.c (move_it_vertically_backward): At the end of the
diff --git a/src/fileio.c b/src/fileio.c
index d328a2d3636..bb39f2a153b 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2409,12 +2409,25 @@ A prefix arg makes KEEP-TIME non-nil. */)
2409 else if (NILP (keep_time)) 2409 else if (NILP (keep_time))
2410 { 2410 {
2411 EMACS_TIME now; 2411 EMACS_TIME now;
2412 DWORD attributes;
2413 char * filename;
2414
2412 EMACS_GET_TIME (now); 2415 EMACS_GET_TIME (now);
2413 if (set_file_times (XSTRING (encoded_newname)->data, 2416 filename = XSTRING (encoded_newname)->data;
2414 now, now)) 2417
2415 Fsignal (Qfile_date_error, 2418 /* Ensure file is writable while its modified time is set. */
2416 Fcons (build_string ("Cannot set file date"), 2419 attributes = GetFileAttributes (filename);
2417 Fcons (newname, Qnil))); 2420 SetFileAttributes (filename, attributes ^ FILE_ATTRIBUTE_READONLY);
2421 if (set_file_times (filename, now, now))
2422 {
2423 /* Restore original attributes. */
2424 SetFileAttributes (filename, attributes);
2425 Fsignal (Qfile_date_error,
2426 Fcons (build_string ("Cannot set file date"),
2427 Fcons (newname, Qnil)));
2428 }
2429 /* Restore original attributes. */
2430 SetFileAttributes (filename, attributes);
2418 } 2431 }
2419#else /* not WINDOWSNT */ 2432#else /* not WINDOWSNT */
2420 ifd = emacs_open (XSTRING (encoded_file)->data, O_RDONLY, 0); 2433 ifd = emacs_open (XSTRING (encoded_file)->data, O_RDONLY, 0);