bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8306: copy-file should report chmod or chown failure


From: Paul Eggert
Subject: bug#8306: copy-file should report chmod or chown failure
Date: Sun, 20 Mar 2011 19:47:51 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8

On the Emacs trunk, (copy-file A B) does not report
an error if A's permissions cannot be copied to B's,
and (copy-file A B nil nil t) does not report an
error if A's ownership info cannot be copied to B's.
I plan to install the following patch so that Emacs
reports errors in these cases.

* fileio.c (Fcopy_file): Report error if fchown or fchmod fail.
=== modified file 'src/fileio.c'
--- src/fileio.c        2011-03-15 21:14:06 +0000
+++ src/fileio.c        2011-03-21 02:38:48 +0000
@@ -1951,9 +1951,10 @@
      owner and group.  */
   if (input_file_statable_p)
     {
-      if (! NILP (preserve_uid_gid))
-       fchown (ofd, st.st_uid, st.st_gid);
-      fchmod (ofd, st.st_mode & 07777);
+      if (!NILP (preserve_uid_gid) && fchown (ofd, st.st_uid, st.st_gid) != 0)
+       report_file_error ("Doing chown", Fcons (newname, Qnil));
+      if (fchmod (ofd, st.st_mode & 07777) != 0)
+       report_file_error ("Doing chmod", Fcons (newname, Qnil));
     }
 #endif /* not MSDOS */






reply via email to

[Prev in Thread] Current Thread [Next in Thread]