summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-09-29 18:16:11 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-09-29 18:21:21 +0200
commit23e31c1076f7d6a6d09014c3ae2fff54692b9e7f (patch)
treeeede31af08164d3125e478fc2c7b8e219c071a1f
parentfbe66e384476e4d9d458e51f56a4e7bc38f71b33 (diff)
Fix: rdsquashfs: describe: don't escape the prefixed file input path
If rdsquashfs describes a filesystem, is configured to use a prefix-path and a file contains a space, the resulting input path has the prefix printed as is and the rest of the string in quotation marks. gensquashfs simply takes the entire rest of the line as is as its input path and no longer finds the file. Fix this by omitting the escapes and quotation marks for the input path. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--bin/rdsquashfs/describe.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/bin/rdsquashfs/describe.c b/bin/rdsquashfs/describe.c
index 924bedc..8f45243 100644
--- a/bin/rdsquashfs/describe.c
+++ b/bin/rdsquashfs/describe.c
@@ -6,7 +6,7 @@
*/
#include "rdsquashfs.h"
-static int print_name(const sqfs_tree_node_t *n)
+static int print_name(const sqfs_tree_node_t *n, bool dont_escape)
{
char *start, *ptr, *name = sqfs_tree_node_get_path(n);
@@ -21,7 +21,8 @@ static int print_name(const sqfs_tree_node_t *n)
return -1;
}
- if (strchr(name, ' ') == NULL && strchr(name, '"') == NULL) {
+ if (dont_escape || (strchr(name, ' ') == NULL &&
+ strchr(name, '"') == NULL)) {
fputs(name, stdout);
} else {
fputc('"', stdout);
@@ -59,7 +60,7 @@ static int print_simple(const char *type, const sqfs_tree_node_t *n,
const char *extra)
{
printf("%s ", type);
- if (print_name(n))
+ if (print_name(n, false))
return -1;
print_perm(n);
if (extra != NULL)
@@ -91,11 +92,11 @@ int describe_tree(const sqfs_tree_node_t *root, const char *unpack_root)
return print_simple("file", root, NULL);
fputs("file ", stdout);
- if (print_name(root))
+ if (print_name(root, false))
return -1;
print_perm(root);
printf(" %s/", unpack_root);
- if (print_name(root))
+ if (print_name(root, true))
return -1;
fputc('\n', stdout);
break;