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/comp/compressor.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/comp/compressor.c')
-rw-r--r-- | lib/sqfs/comp/compressor.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/sqfs/comp/compressor.c b/lib/sqfs/comp/compressor.c index 005dbd4..4d073f2 100644 --- a/lib/sqfs/comp/compressor.c +++ b/lib/sqfs/comp/compressor.c @@ -9,7 +9,6 @@ #include <string.h> #include <stdlib.h> -#include <stdio.h> #include "internal.h" #include "util.h" @@ -53,7 +52,7 @@ int sqfs_generic_write_options(int fd, const void *data, size_t size) if (write_data("writing compressor options", fd, buffer, sizeof(buffer))) { - return -1; + return SQFS_ERROR_IO; } return sizeof(buffer); @@ -65,14 +64,11 @@ int sqfs_generic_read_options(int fd, void *data, size_t size) if (read_data_at("reading compressor options", sizeof(sqfs_super_t), fd, buffer, sizeof(buffer))) { - return -1; + return SQFS_ERROR_IO; } - if (le16toh(*((uint16_t *)buffer)) != (0x8000 | size)) { - fputs("reading compressor options: invalid meta data header\n", - stderr); - return -1; - } + if (le16toh(*((uint16_t *)buffer)) != (0x8000 | size)) + return SQFS_ERROR_CORRUPTED; memcpy(data, buffer + 2, size); return 0; |