diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-03-05 22:38:15 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-03-05 22:41:04 +0100 |
commit | 85e36aab1258d8d9ec7b61ce013f167ef8e03ae0 (patch) | |
tree | b1d59cce7894520b53c6b1fa86666d91587aaf82 /extras/list_files.c | |
parent | 5acb22a6a7168f8b961777482f39a125158def50 (diff) |
Change the signature of sqfs_compressor_create to return an error code
Make sure the function has a way of telling the caller *why* it failed.
This way, the function can convey whether it had an internal error, an
allocation failure, whether the arguments are totaly nonsensical, or
simply that the compressor *or specific configuration* is not supported.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'extras/list_files.c')
-rw-r--r-- | extras/list_files.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/extras/list_files.c b/extras/list_files.c index 5e181f2..eba4fff 100644 --- a/extras/list_files.c +++ b/extras/list_files.c @@ -47,6 +47,7 @@ static void write_tree_dfs(const sqfs_tree_node_t *n) int main(int argc, char **argv) { + int ret, status = EXIT_FAILURE; sqfs_compressor_config_t cfg; sqfs_compressor_t *cmp; sqfs_tree_node_t *root = NULL; @@ -54,7 +55,6 @@ int main(int argc, char **argv) sqfs_dir_reader_t *dr; sqfs_file_t *file; sqfs_super_t super; - int status = EXIT_FAILURE; /* open the SquashFS file we want to read */ if (argc != 2) { @@ -84,9 +84,10 @@ int main(int argc, char **argv) super.block_size, SQFS_COMP_FLAG_UNCOMPRESS); - cmp = sqfs_compressor_create(&cfg); - if (cmp == NULL) { - fprintf(stderr, "%s: error creating compressor.\n", argv[1]); + ret = sqfs_compressor_create(&cfg, &cmp); + if (ret != 0) { + fprintf(stderr, "%s: error creating compressor: %d.\n", + argv[1], ret); goto out_fd; } |