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 /tar | |
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 'tar')
-rw-r--r-- | tar/sqfs2tar.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tar/sqfs2tar.c b/tar/sqfs2tar.c index 2e4d0ef..2b013d6 100644 --- a/tar/sqfs2tar.c +++ b/tar/sqfs2tar.c @@ -556,15 +556,15 @@ int main(int argc, char **argv) super.block_size, SQFS_COMP_FLAG_UNCOMPRESS); - cmp = sqfs_compressor_create(&cfg); + ret = sqfs_compressor_create(&cfg, &cmp); #ifdef WITH_LZO - if (super.compression_id == SQFS_COMP_LZO && cmp == NULL) - cmp = lzo_compressor_create(&cfg); + if (super.compression_id == SQFS_COMP_LZO && ret != 0) + ret = lzo_compressor_create(&cfg, &cmp); #endif - if (cmp == NULL) { - fputs("Error creating compressor.\n", stderr); + if (ret != 0) { + sqfs_perror(filename, "creating compressor", ret); goto out_fd; } |