From: Dr. David von Oheimb Date: Sun, 13 Apr 2025 08:00:15 +0000 (+0200) Subject: apps/cms.c: clarify treatment of 'ret' variable in cms_main() X-Git-Tag: openssl-3.6.0-alpha1~753 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3da4b584e0ee07c51914c11f2413e6f25df64a0;p=thirdparty%2Fopenssl.git apps/cms.c: clarify treatment of 'ret' variable in cms_main() Reviewed-by: Tomas Mraz Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/27368) --- diff --git a/apps/cms.c b/apps/cms.c index f3a1ba6e11b..7af43a2afc4 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -1244,6 +1244,7 @@ int cms_main(int argc, char **argv) goto end; } } else { + /* within this block, ret > 0 means 'ok' */ if (noout) { if (print) { ASN1_PCTX *pctx = NULL; @@ -1258,6 +1259,7 @@ int cms_main(int argc, char **argv) CMS_ContentInfo_print_ctx(out, cms, 0, pctx); ASN1_PCTX_free(pctx); } + ret = 1; } else if (outformat == FORMAT_SMIME) { if (to) BIO_printf(out, "To: %s%s", to, mime_eol); @@ -1285,7 +1287,7 @@ int cms_main(int argc, char **argv) } ret = 0; end: - if (ret) + if (ret != 0) ERR_print_errors(bio_err); OSSL_STACK_OF_X509_free(encerts); OSSL_STACK_OF_X509_free(other);