summaryrefslogtreecommitdiff
path: root/unpack/restore_fstree.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-05-04 23:30:58 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-05-05 00:10:28 +0200
commitda5656a8a696863e0d9941091c09c75b03a6070b (patch)
tree175f713894fda83722be311e6b66bb957da11eaa /unpack/restore_fstree.c
parenta2750dee0e4c374ae51f83eead7eb7df3c018d95 (diff)
Print out what we are doing on the way and options to keep quiet
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'unpack/restore_fstree.c')
-rw-r--r--unpack/restore_fstree.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/unpack/restore_fstree.c b/unpack/restore_fstree.c
index c06cd2b..c1320ea 100644
--- a/unpack/restore_fstree.c
+++ b/unpack/restore_fstree.c
@@ -1,10 +1,26 @@
/* SPDX-License-Identifier: GPL-3.0-or-later */
#include "rdsquashfs.h"
+static void print_name(tree_node_t *n)
+{
+ if (n->parent != NULL) {
+ print_name(n->parent);
+ fputc('/', stdout);
+ }
+
+ fputs(n->name, stdout);
+}
+
static int create_node(int dirfd, tree_node_t *n, unsqfs_info_t *info)
{
int fd;
+ if (!(info->flags & UNPACK_QUIET)) {
+ fputs("unpacking ", stdout);
+ print_name(n);
+ fputc('\n', stdout);
+ }
+
switch (n->mode & S_IFMT) {
case S_IFDIR:
if (mkdirat(dirfd, n->name, 0755) && errno != EEXIST) {