summaryrefslogtreecommitdiff
path: root/bin/rdsquashfs/fill_files.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-02-09 16:14:27 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-02-09 16:17:23 +0100
commitf9ca81a4768e06e2a01b555640173b5ec09fc4c8 (patch)
tree8688aefe824788ef4859d1c73ee915a3603d176b /bin/rdsquashfs/fill_files.c
parentae048f7ac4a9ab6576ca6842aa13e5c9c31e35a7 (diff)
Fixup extaction paths for rdsquashfs on Windows
- If we generate a manifest file, use the fix-path function to produce a fixed up, actual name as the source path. - When unpacking, create files for the fixed up, actual name. There is no need to touch gensquashfs, if the manifest file is used to re-pack the stuff, the original paths are used and the files are source from the fixed-up paths. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin/rdsquashfs/fill_files.c')
-rw-r--r--bin/rdsquashfs/fill_files.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/bin/rdsquashfs/fill_files.c b/bin/rdsquashfs/fill_files.c
index 660ef1b..73b90e3 100644
--- a/bin/rdsquashfs/fill_files.c
+++ b/bin/rdsquashfs/fill_files.c
@@ -73,10 +73,8 @@ static int add_file(const sqfs_tree_node_t *node)
new_sz = max_files ? max_files * 2 : 256;
new = realloc(files, sizeof(files[0]) * new_sz);
- if (new == NULL) {
- perror("expanding file list");
- return -1;
- }
+ if (new == NULL)
+ goto fail_oom;
files = new;
max_files = new_sz;
@@ -94,10 +92,25 @@ static int add_file(const sqfs_tree_node_t *node)
return -1;
}
+#if defined(_WIN32) || defined(__WINDOWS__)
+ {
+ char *fixed = fix_win32_filename(path);
+ sqfs_free(path);
+
+ if (fixed == NULL)
+ goto fail_oom;
+
+ path = fixed;
+ }
+#endif
+
files[num_files].path = path;
files[num_files].inode = node->inode;
num_files++;
return 0;
+fail_oom:
+ fputs(stderr, "add_file: out of memor!\n");
+ return -1;
}
static void clear_file_list(void)