diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-11-18 09:07:48 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-11-18 12:33:05 +0100 |
commit | 74963b9653e007ea5c47b2f165b675fdda1c757c (patch) | |
tree | d8d829f3ca8e8c49fa77ae42a50537017bb1ea42 /mkfs/dirscan.c | |
parent | bca4dfec757a0c3c62551427268c65de06107db4 (diff) |
Cleanup: gensquashfs: don't store the filepath for directory scan
Since we can reconstruct the path at any time, simply do so instead
of explicitly duplicating and storing it.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'mkfs/dirscan.c')
-rw-r--r-- | mkfs/dirscan.c | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/mkfs/dirscan.c b/mkfs/dirscan.c index c0572f5..6cb2295 100644 --- a/mkfs/dirscan.c +++ b/mkfs/dirscan.c @@ -6,39 +6,6 @@ */ #include "mkfs.h" -static char *get_file_path(tree_node_t *n, const char *name) -{ - char *ptr, *new; - int ret; - - if (n->parent == NULL) { - ptr = strdup(name); - if (ptr == NULL) - goto fail; - return ptr; - } - - ptr = fstree_get_path(n); - if (ptr == NULL) - goto fail; - - ret = canonicalize_name(ptr); - assert(ret == 0); - - new = realloc(ptr, strlen(ptr) + strlen(name) + 2); - if (new == NULL) - goto fail; - - ptr = new; - strcat(ptr, "/"); - strcat(ptr, name); - return ptr; -fail: - perror("getting absolute file path"); - free(ptr); - return NULL; -} - #ifdef HAVE_SYS_XATTR_H static int populate_xattr(sqfs_xattr_writer_t *xwr, tree_node_t *node) { @@ -163,10 +130,6 @@ static int populate_dir(fstree_t *fs, tree_node_t *root, dev_t devstart, goto fail_rdlink; extra[sb.st_size] = '\0'; - } else if (S_ISREG(sb.st_mode)) { - extra = get_file_path(root, ent->d_name); - if (extra == NULL) - goto fail; } if (!(flags & DIR_SCAN_KEEP_TIME)) |