diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-05-26 11:53:38 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-05-26 11:56:48 +0200 |
commit | 87dd817c4e17b478b08cd6cf9c63c45e695e64f1 (patch) | |
tree | 17e4cb82a10fc66990aef891824d886f01de694a | |
parent | c067eee9c2e5fd97de7e9d74bfd4521984d23e3e (diff) |
sqfsdiff: extract compressor options, but don't fail on error
This commit modifies sqfsdiff to extract the compressor options from
the squashfs image and store them in a compressor configuration if
possible. The failure path is modified to *not* burst into flames on
error, because those options are not required by any compressor to
read data from the disk and pretty much every vendor modifed SquashFS
has messed with those to the point that they cannot be propperly
decoded (or the flag is set and there are no options).
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r-- | bin/sqfsdiff/sqfsdiff.c | 11 | ||||
-rw-r--r-- | bin/sqfsdiff/sqfsdiff.h | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/bin/sqfsdiff/sqfsdiff.c b/bin/sqfsdiff/sqfsdiff.c index 2871322..b543c00 100644 --- a/bin/sqfsdiff/sqfsdiff.c +++ b/bin/sqfsdiff/sqfsdiff.c @@ -40,10 +40,17 @@ static int open_sfqs(sqfs_state_t *state, const char *path) if (state->super.flags & SQFS_FLAG_COMPRESSOR_OPTIONS) { ret = state->cmp->read_options(state->cmp, state->file); - if (ret) { + + if (ret == 0) { + state->cmp->get_configuration(state->cmp, + &state->options); + state->have_options = true; + } else { sqfs_perror(path, "reading compressor options", ret); - goto fail_cmp; + state->have_options = false; } + } else { + state->have_options = false; } state->idtbl = sqfs_id_table_create(0); diff --git a/bin/sqfsdiff/sqfsdiff.h b/bin/sqfsdiff/sqfsdiff.h index 94fce93..a8f1b32 100644 --- a/bin/sqfsdiff/sqfsdiff.h +++ b/bin/sqfsdiff/sqfsdiff.h @@ -27,6 +27,9 @@ typedef struct { sqfs_dir_reader_t *dr; sqfs_tree_node_t *root; sqfs_data_reader_t *data; + + sqfs_compressor_config_t options; + bool have_options; } sqfs_state_t; typedef struct { |