Mercurial > emacs
changeset 63719:c3da886cec72
(Frename_file): Preserve owner and group, if possible.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 23 Jun 2005 21:29:26 +0000 |
parents | 47f9bb41d144 |
children | 10d4557c5555 |
files | src/fileio.c |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fileio.c Thu Jun 23 21:28:07 2005 +0000 +++ b/src/fileio.c Thu Jun 23 21:29:26 2005 +0000 @@ -2775,6 +2775,7 @@ { if (errno == EXDEV) { + struct stat data; #ifdef S_IFLNK symlink_target = Ffile_symlink_p (file); if (! NILP (symlink_target)) @@ -2787,6 +2788,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