The propagation of errors from loading function through errno must make
sure that errno is positive, otherwise errors are not correctly spotted.
Fixes: 81e5c797 ("libkmod: propagate {zstd,xz,zlib}_load errors")
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/242
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
ret = ZSTD_decompress(dst_buf, dst_size, src_buf, src_size);
if (ZSTD_isError(ret)) {
ERR(file->ctx, "zstd: %s\n", ZSTD_getErrorName(ret));
+ ret = -EINVAL;
goto out;
}
err = kmod_file_load_contents(file);
if (err) {
- errno = err;
+ errno = -err;
return NULL;
}