[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111374: Improve copy-file diagnostic
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111374: Improve copy-file diagnostics on MS-Windows. |
Date: |
Sat, 29 Dec 2012 19:47:39 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111374
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2012-12-29 19:47:39 +0200
message:
Improve copy-file diagnostics on MS-Windows.
src/fileio.c (Fcopy_file) [WINDOWSNT]: Improve diagnostics when CopyFile
fails by looking at what GetLastError returns.
modified:
src/ChangeLog
src/fileio.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-12-29 14:32:36 +0000
+++ b/src/ChangeLog 2012-12-29 17:47:39 +0000
@@ -3,6 +3,7 @@
* fileio.c (Fset_file_selinux_context, Fset_file_acl): Return t if
file's SELinux context or ACLs successfully set, nil otherwise.
(Bug#13298)
+ (Fcopy_file) [WINDOWSNT]: Improve diagnostics when CopyFile fails.
* w32proc.c (reader_thread): Avoid passing NULL handles to
SetEvent and WaitForSingleObject.
=== modified file 'src/fileio.c'
--- a/src/fileio.c 2012-12-29 17:02:34 +0000
+++ b/src/fileio.c 2012-12-29 17:47:39 +0000
@@ -2029,7 +2029,15 @@
if (!CopyFile (SDATA (encoded_file),
SDATA (encoded_newname),
FALSE))
- report_file_error ("Copying file", Fcons (file, Fcons (newname, Qnil)));
+ {
+ /* CopyFile doesn't set errno when it fails. By far the most
+ "popular" reason is that the target is read-only. */
+ if (GetLastError () == 5)
+ errno = EACCES;
+ else
+ errno = EPERM;
+ report_file_error ("Copying file", Fcons (file, Fcons (newname, Qnil)));
+ }
/* CopyFile retains the timestamp by default. */
else if (NILP (keep_time))
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111374: Improve copy-file diagnostics on MS-Windows.,
Eli Zaretskii <=