summaryrefslogtreecommitdiff
path: root/src/fileio.c
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2005-06-25 15:00:08 +0000
committerKaroly Lorentey <lorentey@elte.hu>2005-06-25 15:00:08 +0000
commit0d0358be7e741898e363d02dbff01b35c662413c (patch)
treee6bdb6ae792a8be712780a5cfad4eeddb09c4f43 /src/fileio.c
parentf4d9bf3a9be50a17c2e2f7569b88f3606ab273d9 (diff)
parentb93e3c3ba1644f5e746c7486bd609ba9fc7ec583 (diff)
downloademacs-0d0358be7e741898e363d02dbff01b35c662413c.tar.gz
emacs-0d0358be7e741898e363d02dbff01b35c662413c.tar.bz2
emacs-0d0358be7e741898e363d02dbff01b35c662413c.zip
Merged from miles@gnu.org--gnu-2005 (patch 441-446)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-441 Update reference to renamed Buffer-menu-buffer face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-442 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-443 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-444 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-445 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-446 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-354
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c
index c38cb924c8b..075f12ccb21 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2777,6 +2777,7 @@ This is what happens in interactive use with M-x. */)
{
if (errno == EXDEV)
{
+ struct stat data;
#ifdef S_IFLNK
symlink_target = Ffile_symlink_p (file);
if (! NILP (symlink_target))
@@ -2789,6 +2790,11 @@ This is what happens in interactive use with M-x. */)
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