copy: optionally apply source inode's stat() when doing a merge copy

This commit is contained in:
Lennart Poettering
2025-10-21 23:09:50 +02:00
parent bcafa70974
commit 0a9e2e45f0
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -1257,7 +1257,7 @@ static int fd_copy_directory(
}
finish:
if (!exists) {
if (FLAGS_SET(copy_flags, COPY_MERGE_APPLY_STAT) || !exists) {
if (fchown(fdt,
uid_is_valid(override_uid) ? override_uid : st->st_uid,
gid_is_valid(override_gid) ? override_gid : st->st_gid) < 0)
+1
View File
@@ -33,6 +33,7 @@ typedef enum CopyFlags {
*/
COPY_NOCOW_AFTER = 1 << 20,
COPY_PRESERVE_FS_VERITY = 1 << 21, /* Preserve fs-verity when copying. */
COPY_MERGE_APPLY_STAT = 1 << 22, /* When we reuse an existing directory inode, apply source ownership/mode/xattrs/timestamps */
} CopyFlags;
typedef enum DenyType {