* NTEmacs fails copy-file
@ 2002-03-08 7:18 Tak Ota
0 siblings, 0 replies; only message in thread
From: Tak Ota @ 2002-03-08 7:18 UTC (permalink / raw)
On NTEmacs 21.2.50, when `copy-file' function take a FILE that has a
read only file attribute, the function fails with an error. Following
patch corrects this problem. The same bug exists in 21.1.90 also.
-Tak
*** fileio.c.orig Mon Mar 4 07:00:02 2002
--- fileio.c Thu Mar 7 23:04:07 2002
***************
*** 2408,2420 ****
report_file_error ("Copying file", Fcons (file, Fcons (newname, Qnil)));
else if (NILP (keep_time))
{
EMACS_TIME now;
EMACS_GET_TIME (now);
if (set_file_times (XSTRING (encoded_newname)->data,
now, now))
! Fsignal (Qfile_date_error,
! Fcons (build_string ("Cannot set file date"),
! Fcons (newname, Qnil)));
}
#else /* not WINDOWSNT */
ifd = emacs_open (XSTRING (encoded_file)->data, O_RDONLY, 0);
--- 2408,2426 ----
report_file_error ("Copying file", Fcons (file, Fcons (newname, Qnil)));
else if (NILP (keep_time))
{
+ DWORD attributes = GetFileAttributes(XSTRING (encoded_newname)->data);
EMACS_TIME now;
EMACS_GET_TIME (now);
+ SetFileAttributes(XSTRING (encoded_newname)->data, attributes & ~FILE_ATTRIBUTE_READONLY);
if (set_file_times (XSTRING (encoded_newname)->data,
now, now))
! {
! SetFileAttributes(XSTRING (encoded_newname)->data, attributes);
! Fsignal (Qfile_date_error,
! Fcons (build_string ("Cannot set file date"),
! Fcons (newname, Qnil)));
! }
! SetFileAttributes(XSTRING (encoded_newname)->data, attributes);
}
#else /* not WINDOWSNT */
ifd = emacs_open (XSTRING (encoded_file)->data, O_RDONLY, 0);
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-03-08 7:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-08 7:18 NTEmacs fails copy-file Tak Ota
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).