diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-07 20:19:05 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-07 20:40:07 +0200 |
commit | 60064dd0412a149fe00cfc4e2f2361c22656db57 (patch) | |
tree | f4a2aaed857aeca621ee96e46e23858d4025fcf8 /lib/sqfs/block_processor.c | |
parent | e71c56420a8fc3dc7e36eb059304a362b47a1c15 (diff) |
Remove printing to stderr in libsquashfs with returning error numbers
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/block_processor.c')
-rw-r--r-- | lib/sqfs/block_processor.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/sqfs/block_processor.c b/lib/sqfs/block_processor.c index 3a57d14..649e97f 100644 --- a/lib/sqfs/block_processor.c +++ b/lib/sqfs/block_processor.c @@ -8,11 +8,11 @@ #include "config.h" #include "sqfs/block_processor.h" +#include "sqfs/error.h" #include "util.h" #include <string.h> #include <stdlib.h> -#include <stdio.h> struct sqfs_block_processor_t { size_t max_block_size; @@ -35,10 +35,8 @@ sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size, proc = alloc_flex(sizeof(*proc), 1, max_block_size); - if (proc == NULL) { - perror("Creating block processor"); + if (proc == NULL) return NULL; - } proc->max_block_size = max_block_size; proc->cmp = cmp; @@ -55,19 +53,23 @@ void sqfs_block_processor_destroy(sqfs_block_processor_t *proc) int sqfs_block_processor_enqueue(sqfs_block_processor_t *proc, sqfs_block_t *block) { - if (sqfs_block_process(block, proc->cmp, - proc->scratch, proc->max_block_size)) + int ret; + + ret = sqfs_block_process(block, proc->cmp, + proc->scratch, proc->max_block_size); + if (ret) goto fail; - if (proc->cb(proc->user, block)) + ret = proc->cb(proc->user, block); + if (ret) goto fail; free(block); return 0; fail: free(block); - proc->status = -1; - return -1; + proc->status = ret; + return ret; } int sqfs_block_processor_finish(sqfs_block_processor_t *proc) |