summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/common/perror.c3
-rw-r--r--lib/sqfs/comp/compressor.c2
-rw-r--r--lib/sqfs/comp/gzip.c2
-rw-r--r--lib/sqfs/comp/lz4.c4
-rw-r--r--lib/sqfs/comp/lzma.c4
-rw-r--r--lib/sqfs/comp/xz.c4
-rw-r--r--lib/sqfs/comp/zstd.c4
-rw-r--r--lib/sqfs/dir_writer.c2
-rw-r--r--lib/sqfs/xattr.c3
9 files changed, 16 insertions, 12 deletions
diff --git a/lib/common/perror.c b/lib/common/perror.c
index 9b9f041..a0a86aa 100644
--- a/lib/common/perror.c
+++ b/lib/common/perror.c
@@ -58,6 +58,9 @@ void sqfs_perror(const char *file, const char *action, int error_code)
case SQFS_ERROR_NOT_FILE:
errstr = "target is not a file";
break;
+ case SQFS_ERROR_ARG_INVALID:
+ errstr = "invalid argument";
+ break;
default:
errstr = "libsquashfs returned an unknown error code";
break;
diff --git a/lib/sqfs/comp/compressor.c b/lib/sqfs/comp/compressor.c
index c835f3f..0b8b5e9 100644
--- a/lib/sqfs/comp/compressor.c
+++ b/lib/sqfs/comp/compressor.c
@@ -141,7 +141,7 @@ int sqfs_compressor_id_from_name(const char *name, E_SQFS_COMPRESSOR *out)
}
}
- return -1;
+ return SQFS_ERROR_UNSUPPORTED;
}
int sqfs_compressor_config_init(sqfs_compressor_config_t *cfg,
diff --git a/lib/sqfs/comp/gzip.c b/lib/sqfs/comp/gzip.c
index 3886e60..7183e5a 100644
--- a/lib/sqfs/comp/gzip.c
+++ b/lib/sqfs/comp/gzip.c
@@ -156,7 +156,7 @@ static sqfs_s32 gzip_do_block(sqfs_compressor_t *base, const sqfs_u8 *in,
size_t written;
if (size >= 0x7FFFFFFF)
- return 0;
+ return SQFS_ERROR_ARG_INVALID;
if (gzip->compress && gzip->opt.strategies != 0) {
strategy = find_strategy(gzip, in, size, out, outsize);
diff --git a/lib/sqfs/comp/lz4.c b/lib/sqfs/comp/lz4.c
index dcee7d8..dd9b6ac 100644
--- a/lib/sqfs/comp/lz4.c
+++ b/lib/sqfs/comp/lz4.c
@@ -66,7 +66,7 @@ static sqfs_s32 lz4_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
int ret;
if (size >= 0x7FFFFFFF)
- return 0;
+ return SQFS_ERROR_ARG_INVALID;
if (lz4->high_compression) {
ret = LZ4_compress_HC((void *)in, (void *)out,
@@ -89,7 +89,7 @@ static sqfs_s32 lz4_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
(void)base;
if (outsize >= 0x7FFFFFFF)
- return 0;
+ return SQFS_ERROR_ARG_INVALID;
ret = LZ4_decompress_safe((void *)in, (void *)out, size, outsize);
diff --git a/lib/sqfs/comp/lzma.c b/lib/sqfs/comp/lzma.c
index 002376f..f7ab428 100644
--- a/lib/sqfs/comp/lzma.c
+++ b/lib/sqfs/comp/lzma.c
@@ -48,7 +48,7 @@ static sqfs_s32 lzma_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
int ret;
if (outsize < LZMA_HEADER_SIZE || size >= 0x7FFFFFFF)
- return 0;
+ return SQFS_ERROR_ARG_INVALID;
lzma_lzma_preset(&opt, LZMA_DEFAULT_LEVEL);
opt.dict_size = lzma->block_size;
@@ -93,7 +93,7 @@ static sqfs_s32 lzma_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
(void)base;
if (size >= 0x7FFFFFFF)
- return 0;
+ return SQFS_ERROR_ARG_INVALID;
if (size < sizeof(lzma_header))
return SQFS_ERROR_CORRUPTED;
diff --git a/lib/sqfs/comp/xz.c b/lib/sqfs/comp/xz.c
index fd0f70b..91d48da 100644
--- a/lib/sqfs/comp/xz.c
+++ b/lib/sqfs/comp/xz.c
@@ -144,7 +144,7 @@ static sqfs_s32 xz_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
size_t i;
if (size >= 0x7FFFFFFF)
- return 0;
+ return SQFS_ERROR_ARG_INVALID;
ret = compress(xz, LZMA_VLI_UNKNOWN, in, size, out, outsize);
if (ret < 0 || xz->flags == 0)
@@ -184,7 +184,7 @@ static sqfs_s32 xz_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
(void)base;
if (outsize >= 0x7FFFFFFF)
- return 0;
+ return SQFS_ERROR_ARG_INVALID;
ret = lzma_stream_buffer_decode(&memlimit, 0, NULL,
in, &src_pos, size,
diff --git a/lib/sqfs/comp/zstd.c b/lib/sqfs/comp/zstd.c
index b2e5d8b..3fac85f 100644
--- a/lib/sqfs/comp/zstd.c
+++ b/lib/sqfs/comp/zstd.c
@@ -58,7 +58,7 @@ static sqfs_s32 zstd_comp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
size_t ret;
if (size >= 0x7FFFFFFF)
- return 0;
+ return SQFS_ERROR_ARG_INVALID;
ret = ZSTD_compressCCtx(zstd->zctx, out, outsize, in, size,
zstd->level);
@@ -76,7 +76,7 @@ static sqfs_s32 zstd_uncomp_block(sqfs_compressor_t *base, const sqfs_u8 *in,
(void)base;
if (outsize >= 0x7FFFFFFF)
- return 0;
+ return SQFS_ERROR_ARG_INVALID;
ret = ZSTD_decompress(out, outsize, in, size);
diff --git a/lib/sqfs/dir_writer.c b/lib/sqfs/dir_writer.c
index 8703b77..673c103 100644
--- a/lib/sqfs/dir_writer.c
+++ b/lib/sqfs/dir_writer.c
@@ -130,7 +130,7 @@ int sqfs_dir_writer_add_entry(sqfs_dir_writer_t *writer, const char *name,
return type;
if (name[0] == '\0')
- return SQFS_ERROR_CORRUPTED;
+ return SQFS_ERROR_ARG_INVALID;
ent = alloc_flex(sizeof(*ent), 1, strlen(name));
if (ent == NULL)
diff --git a/lib/sqfs/xattr.c b/lib/sqfs/xattr.c
index 6ce6b9a..909a9a5 100644
--- a/lib/sqfs/xattr.c
+++ b/lib/sqfs/xattr.c
@@ -7,6 +7,7 @@
#define SQFS_BUILDING_DLL
#include "config.h"
#include "sqfs/xattr.h"
+#include "sqfs/error.h"
#include <string.h>
@@ -32,7 +33,7 @@ int sqfs_get_xattr_prefix_id(const char *key)
}
}
- return -1;
+ return SQFS_ERROR_UNSUPPORTED;
}
const char *sqfs_get_xattr_prefix(E_SQFS_XATTR_TYPE id)