diff src/fileio.c @ 90197:b7da78284d4c

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-65 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 425-445) - Remove "-face" suffix from gnus faces - Update from CVS - Remove "-face" suffix from MH-E faces - Remove "-face" suffix from cc-mode faces - Remove "-face" suffix from eshell faces - Remove "-face" suffix from ediff faces - Implement tty vertical-divider face - Rename vertical-divider face to vertical-border - Change escape-glyph color on dark backgrounds back to cyan - Update reference to renamed Buffer-menu-buffer face
author Miles Bader <miles@gnu.org>
date Fri, 24 Jun 2005 01:59:52 +0000
parents 01137c1fdbe9 c3da886cec72
children bb71c6cf2009
line wrap: on
line diff
--- a/src/fileio.c	Wed Jun 15 23:37:29 2005 +0000
+++ b/src/fileio.c	Fri Jun 24 01:59:52 2005 +0000
@@ -2780,6 +2780,7 @@
     {
       if (errno == EXDEV)
 	{
+	  struct stat data;
 #ifdef S_IFLNK
           symlink_target = Ffile_symlink_p (file);
           if (! NILP (symlink_target))
@@ -2792,6 +2793,11 @@
                            so don't have copy-file prompt again.  */
                         NILP (ok_if_already_exists) ? Qnil : Qt,
 			Qt, Qnil);
+
+	  /* Preserve owner and group, if possible (if we are root).  */
+	  if (stat (SDATA (encoded_file), &data) >= 0)
+	    chown (SDATA (encoded_file), data.st_uid, data.st_gid);
+
 	  Fdelete_file (file);
 	}
       else