From: Samanta Navarro Date: Sun, 4 Sep 2022 11:54:19 +0000 (+0000) Subject: copy_tree: use fchmodat instead of chmod X-Git-Tag: 4.13~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3bdb28e57e5e38c1e89347976c7d61a181eec32;p=thirdparty%2Fshadow.git copy_tree: use fchmodat instead of chmod Fixes regression introduced in faeab50e710131816b261de66141524898c2c487 for setups configured without acl support. --- diff --git a/libmisc/copydir.c b/libmisc/copydir.c index 5605f6fe0..b6025f4c7 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 /*