From c3da4b584e0ee07c51914c11f2413e6f25df64a0 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Sun, 13 Apr 2025 10:00:15 +0200 Subject: [PATCH] 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) --- apps/cms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.47.2