From d0ce037fa20f2040b2d82e849f650f55b961ddfa Mon Sep 17 00:00:00 2001 From: Mariusz Zaborski Date: Wed, 2 Feb 2022 13:34:14 -0500 Subject: [PATCH] ZStandard: Add additional check of error code --- contrib/zstd/utils/utils_zstd.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/zstd/utils/utils_zstd.cc b/contrib/zstd/utils/utils_zstd.cc index e838d44..9a8936f 100644 --- a/contrib/zstd/utils/utils_zstd.cc +++ b/contrib/zstd/utils/utils_zstd.cc @@ -115,12 +115,14 @@ absl::Status CompressStream(ZstdApi& api, std::ifstream& in_file, SAPI_ASSIGN_OR_RETURN(iserr, api.ZSTD_CCtx_setParameter( &rcctx, ZSTD_c_compressionLevel, level)); - if (!iserr) { + SAPI_ASSIGN_OR_RETURN(iserr, api.ZSTD_isError(iserr)) + if (iserr) { return absl::UnavailableError("Unable to set parameter"); } SAPI_ASSIGN_OR_RETURN( iserr, api.ZSTD_CCtx_setParameter(&rcctx, ZSTD_c_checksumFlag, 1)); - if (!iserr) { + SAPI_ASSIGN_OR_RETURN(iserr, api.ZSTD_isError(iserr)) + if (iserr) { return absl::UnavailableError("Unable to set parameter"); }