summaryrefslogtreecommitdiff
path: root/unpack/restore_fstree.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-19 16:02:31 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-19 16:02:31 +0200
commit42479fe6351a0d5f8c233c157010a66fed43cc70 (patch)
tree97d020ca623bbf45e6ec71d4d03b4289a8d4799c /unpack/restore_fstree.c
parentc40373dd16a15f187252b9b1d21a9ab588ece4de (diff)
Fix chmod of symlinks in restore_fstree
We can't change the mod of symlinks and hence AT_SYMLINK_NOFOLLOW is not supported by chmod(2 -> RTFM!). The solution is to not use that flag and simply skip symlinks. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'unpack/restore_fstree.c')
-rw-r--r--unpack/restore_fstree.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/unpack/restore_fstree.c b/unpack/restore_fstree.c
index 4e763cb..21bae3f 100644
--- a/unpack/restore_fstree.c
+++ b/unpack/restore_fstree.c
@@ -157,9 +157,8 @@ static int set_attribs(fstree_t *fs, tree_node_t *n, int flags)
}
}
- if (flags & UNPACK_CHMOD) {
- if (fchmodat(AT_FDCWD, n->name, n->mode,
- AT_SYMLINK_NOFOLLOW)) {
+ if (flags & UNPACK_CHMOD && !S_ISLNK(n->mode)) {
+ if (fchmodat(AT_FDCWD, n->name, n->mode, 0)) {
fprintf(stderr, "chmod %s: %s\n",
n->name, strerror(errno));
return -1;