mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-20 18:17:20 +00:00
(Frename_file): Preserve owner and group, if possible.
This commit is contained in:
parent
7407e52e20
commit
d550c42590
@ -2775,6 +2775,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))
|
||||
@ -2787,6 +2788,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
|
||||
|
Loading…
Reference in New Issue
Block a user