aboutsummaryrefslogtreecommitdiff
path: root/lib/io/src
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-09-08 21:24:07 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-09-08 22:24:44 +0200
commitd17046773702aad9cb3269a23ecd35f5a4a552ff (patch)
tree7cb14d8024a869239763590dcc24722c5a9cb72d /lib/io/src
parentf5e46e0444197deee2eca93d36a8ebeb1ffd7a17 (diff)
genquashfs: detect/filter hardlinks when scanning a directory
The new behavior is enabled by default (except on Windows) and needs to be turned off explicitly. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/io/src')
-rw-r--r--lib/io/src/dir_tree_iterator.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/io/src/dir_tree_iterator.c b/lib/io/src/dir_tree_iterator.c
index 3c25529..5688489 100644
--- a/lib/io/src/dir_tree_iterator.c
+++ b/lib/io/src/dir_tree_iterator.c
@@ -229,9 +229,15 @@ sqfs_dir_iterator_t *dir_tree_iterator_create(const char *path,
ret = sqfs_dir_iterator_create_recursive(&it->rec, dir);
sqfs_drop(dir);
- if (ret) {
- fprintf(stderr, "%s: out of memory\n", path);
- goto fail;
+ if (ret)
+ goto fail_oom;
+
+ if (!(cfg->flags & DIR_SCAN_NO_HARDLINKS)) {
+ ret = sqfs_hard_link_filter_create(&dir, it->rec);
+ sqfs_drop(it->rec);
+ it->rec = dir;
+ if (ret)
+ goto fail_oom;
}
sqfs_object_init(it, destroy, NULL);
@@ -243,6 +249,8 @@ sqfs_dir_iterator_t *dir_tree_iterator_create(const char *path,
((sqfs_dir_iterator_t *)it)->read_xattr = read_xattr;
return (sqfs_dir_iterator_t *)it;
+fail_oom:
+ fprintf(stderr, "%s: out of memory\n", path);
fail:
free(it);
return NULL;