summaryrefslogtreecommitdiff
path: root/bin/rdsquashfs/describe.c
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:19:53 +0200
commit4bb856fc93050b73f63c5c2c0c7abd4f6e0fbc90 (patch)
treed361812ad1ca300b67fb7f9a7141f4d4d9db95e6 /bin/rdsquashfs/describe.c
parent30e8abe86cc604672dff3896cdea2a75ed622a4f (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>
Diffstat (limited to 'bin/rdsquashfs/describe.c')
-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;