diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-06-11 17:56:09 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-06-11 18:04:04 +0200 |
commit | cfbbe12db970b266186775350267f163967d2ede (patch) | |
tree | 4a315590c0f83f475c8fb1270a8180fbed9a6ff1 /unpack/restore_fstree.c | |
parent | 578fc9124db4c50ca8c5fac865296139be8c8dfd (diff) |
cleanup: get rid of unsqfs_info_t
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'unpack/restore_fstree.c')
-rw-r--r-- | unpack/restore_fstree.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/unpack/restore_fstree.c b/unpack/restore_fstree.c index a39ec97..976b15c 100644 --- a/unpack/restore_fstree.c +++ b/unpack/restore_fstree.c @@ -1,12 +1,12 @@ /* SPDX-License-Identifier: GPL-3.0-or-later */ #include "rdsquashfs.h" -static int create_node(tree_node_t *n, unsqfs_info_t *info) +static int create_node(tree_node_t *n, data_reader_t *data, int flags) { char *name; int fd; - if (!(info->flags & UNPACK_QUIET)) { + if (!(flags & UNPACK_QUIET)) { name = fstree_get_path(n); printf("unpacking %s\n", name); free(name); @@ -24,7 +24,7 @@ static int create_node(tree_node_t *n, unsqfs_info_t *info) return -1; for (n = n->data.dir->children; n != NULL; n = n->next) { - if (create_node(n, info)) + if (create_node(n, data, flags)) return -1; } @@ -63,7 +63,7 @@ static int create_node(tree_node_t *n, unsqfs_info_t *info) return -1; } - if (data_reader_dump_file(info->data, n->data.file, fd)) { + if (data_reader_dump_file(data, n->data.file, fd)) { close(fd); return -1; } @@ -74,7 +74,7 @@ static int create_node(tree_node_t *n, unsqfs_info_t *info) break; } - if (info->flags & UNPACK_CHOWN) { + if (flags & UNPACK_CHOWN) { if (fchownat(AT_FDCWD, n->name, n->uid, n->gid, AT_SYMLINK_NOFOLLOW)) { fprintf(stderr, "chown %s: %s\n", @@ -83,7 +83,7 @@ static int create_node(tree_node_t *n, unsqfs_info_t *info) } } - if (info->flags & UNPACK_CHMOD) { + if (flags & UNPACK_CHMOD) { if (fchmodat(AT_FDCWD, n->name, n->mode, AT_SYMLINK_NOFOLLOW)) { fprintf(stderr, "chmod %s: %s\n", @@ -94,7 +94,8 @@ static int create_node(tree_node_t *n, unsqfs_info_t *info) return 0; } -int restore_fstree(const char *rootdir, tree_node_t *root, unsqfs_info_t *info) +int restore_fstree(const char *rootdir, tree_node_t *root, + data_reader_t *data, int flags) { tree_node_t *n; @@ -108,11 +109,11 @@ int restore_fstree(const char *rootdir, tree_node_t *root, unsqfs_info_t *info) if (S_ISDIR(root->mode)) { for (n = root->data.dir->children; n != NULL; n = n->next) { - if (create_node(n, info)) + if (create_node(n, data, flags)) return -1; } } else { - if (create_node(root, info)) + if (create_node(root, data, flags)) return -1; } |