From f3bdb28e57e5e38c1e89347976c7d61a181eec32 Mon Sep 17 00:00:00 2001 From: Samanta Navarro Date: Sun, 4 Sep 2022 11:54:19 +0000 Subject: [PATCH] copy_tree: use fchmodat instead of chmod Fixes regression introduced in faeab50e710131816b261de66141524898c2c487 for setups configured without acl support. --- libmisc/copydir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmisc/copydir.c b/libmisc/copydir.c index 5605f6fe..b6025f4c 100644 --- a/libmisc/copydir.c +++ b/libmisc/copydir.c @@ -529,7 +529,7 @@ static int copy_dir (const struct path_info *src, const struct path_info *dst, || ( (perm_copy_path (src, dst, &ctx) != 0) && (errno != 0)) #else /* !WITH_ACL */ - || (chmod (dst, statp->st_mode) != 0) + || (fchmodat (dst->dirfd, dst->name, statp->st_mode & 07777, AT_SYMLINK_NOFOLLOW) != 0) #endif /* !WITH_ACL */ #ifdef WITH_ATTR /*