aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--unpack/restore_fstree.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/unpack/restore_fstree.c b/unpack/restore_fstree.c
index 2ee4c08..4e763cb 100644
--- a/unpack/restore_fstree.c
+++ b/unpack/restore_fstree.c
@@ -192,8 +192,20 @@ int restore_fstree(tree_node_t *root, int flags)
int update_tree_attribs(fstree_t *fs, tree_node_t *root, int flags)
{
+ tree_node_t *n;
+
if ((flags & (UNPACK_CHOWN | UNPACK_CHMOD | UNPACK_SET_TIMES)) == 0)
return 0;
- return set_attribs(fs, root, flags);
+ if (S_ISDIR(root->mode)) {
+ for (n = root->data.dir->children; n != NULL; n = n->next) {
+ if (set_attribs(fs, n, flags))
+ return -1;
+ }
+ } else {
+ if (set_attribs(fs, root, flags))
+ return -1;
+ }
+
+ return 0;
}