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/sqfshelper/data_reader.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/sqfshelper/data_reader.c')
-rw-r--r-- | lib/sqfshelper/data_reader.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/sqfshelper/data_reader.c b/lib/sqfshelper/data_reader.c index f7984b8..fc92e28 100644 --- a/lib/sqfshelper/data_reader.c +++ b/lib/sqfshelper/data_reader.c @@ -109,6 +109,8 @@ data_reader_t *data_reader_create(int fd, sqfs_super_t *super, { data_reader_t *data = alloc_flex(sizeof(*data), super->block_size, 3); size_t i, size; + void *raw_frag; + int ret; if (data == NULL) { perror("creating data reader"); @@ -142,15 +144,17 @@ data_reader_t *data_reader_create(int fd, sqfs_super_t *super, return NULL; } - data->frag = sqfs_read_table(fd, cmp, size, - super->fragment_table_start, - super->directory_table_start, - super->fragment_table_start); - if (data->frag == NULL) { + ret = sqfs_read_table(fd, cmp, size, super->fragment_table_start, + super->directory_table_start, + super->fragment_table_start, &raw_frag); + + if (ret) { free(data); return NULL; } + data->frag = raw_frag; + for (i = 0; i < data->num_fragments; ++i) { data->frag[i].size = le32toh(data->frag[i].size); data->frag[i].start_offset = |