]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps/cms.c: clarify treatment of 'ret' variable in cms_main()
authorDr. David von Oheimb <dev@ddvo.net>
Sun, 13 Apr 2025 08:00:15 +0000 (10:00 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Wed, 14 May 2025 06:43:20 +0000 (08:43 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27368)

apps/cms.c

index f3a1ba6e11ba96d05f69e2f01d74ed79f940e309..7af43a2afc47ec504ac1f58694e87e557eb4bb99 100644 (file)
@@ -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);