aboutsummaryrefslogtreecommitdiff
path: root/lib/util/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util/src')
-rw-r--r--lib/util/src/dir_tree_iterator.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/util/src/dir_tree_iterator.c b/lib/util/src/dir_tree_iterator.c
index ccc63ac..37ddbea 100644
--- a/lib/util/src/dir_tree_iterator.c
+++ b/lib/util/src/dir_tree_iterator.c
@@ -165,6 +165,22 @@ retry:
}
}
+ if (it->cfg.prefix != NULL) {
+ size_t slen = strlen(ent->name), len = strlen(it->cfg.prefix);
+ void *new = realloc(ent, sizeof(*ent) + len + 1 + slen + 1);
+
+ if (new == NULL) {
+ ret = SQFS_ERROR_ALLOC;
+ goto fail;
+ }
+
+ ent = new;
+ memmove(ent->name + len + 1, ent->name, slen + 1);
+ memcpy(ent->name, it->cfg.prefix, len);
+ ent->name[len] = '/';
+ plen += len + 1;
+ }
+
if (!(it->cfg.flags & DIR_SCAN_KEEP_TIME))
ent->mtime = it->cfg.def_mtime;