]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
copy_tree: use fchmodat instead of chmod
authorSamanta Navarro <ferivoz@riseup.net>
Sun, 4 Sep 2022 11:54:19 +0000 (11:54 +0000)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Fri, 9 Sep 2022 13:19:12 +0000 (15:19 +0200)
Fixes regression introduced in faeab50e710131816b261de66141524898c2c487
for setups configured without acl support.

libmisc/copydir.c

index 5605f6fe08158f783323ce9aad20dd80525e9c09..b6025f4c7db8e32e39d7f423e9b554e716ce0c52 100644 (file)
@@ -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
        /*