aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-04-16 01:19:13 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-04-16 01:19:13 +0200
commit44fb01e8a8417fadd79ba347c9ad3f0bb3a1d0b8 (patch)
tree045d4ba29b60ed1a28fc2eb55caf01b570e46156
parentb3f2636f44eea1a8b6fbf892d2daa611cff9d4af (diff)
sqfs2tar: Fix trailing slashes for directory names
sqfs2tar is supposed to append slashes to directory names. Until now, it assumed a tree node to be a directory if it has children. This simple check obviously fails for empty directories. This commit fixes the check by actually testing the inode mode. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--tar/sqfs2tar.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tar/sqfs2tar.c b/tar/sqfs2tar.c
index b21570a..6d2a51a 100644
--- a/tar/sqfs2tar.c
+++ b/tar/sqfs2tar.c
@@ -351,6 +351,8 @@ static int write_tree_dfs(const sqfs_tree_node_t *n)
size_t len;
int ret;
+ inode_stat(n, &sb);
+
if (n->parent == NULL) {
if (root_becomes == NULL)
goto skip_hdr;
@@ -394,13 +396,11 @@ static int write_tree_dfs(const sqfs_tree_node_t *n)
}
}
- name = assemble_tar_path(name, n->children != NULL);
+ name = assemble_tar_path(name, S_ISDIR(sb.st_mode));
if (name == NULL)
return -1;
}
- inode_stat(n, &sb);
-
if (lnk != NULL) {
ret = write_hard_link(out_file, &sb, name, lnk->target,
record_counter++);