summaryrefslogtreecommitdiff
path: root/demos/cms/cms_enc.c
diff options
context:
space:
mode:
authorslontis <shane.lontis@oracle.com>2023-03-20 14:48:33 +1000
committerTomas Mraz <tomas@openssl.org>2023-04-24 14:39:19 +0200
commit09ff84bd2752cac649f57cfbf95b49dbce1c69ee (patch)
tree9a3dbf4aa9835f2be7d874cde743f6dfa1de6293 /demos/cms/cms_enc.c
parenta80840c663e3409203b0235764e53d8624f74cb8 (diff)
downloadopenssl-new-09ff84bd2752cac649f57cfbf95b49dbce1c69ee.tar.gz
Fixup demo exit status magic numbers
The demo code is quite often block copied for new demos, so this PR changes demos to use EXIT_SUCCESS & EXIT_FAILURE instead of using 0 and 1. Internal functions use the normal notation of 0 = error, 1 = success, but the value returned by main() must use EXIT_SUCCESS and EXIT_FAILURE. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20545)
Diffstat (limited to 'demos/cms/cms_enc.c')
-rw-r--r--demos/cms/cms_enc.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/demos/cms/cms_enc.c b/demos/cms/cms_enc.c
index ff5632a714..3af321521c 100644
--- a/demos/cms/cms_enc.c
+++ b/demos/cms/cms_enc.c
@@ -18,7 +18,7 @@ int main(int argc, char **argv)
X509 *rcert = NULL;
STACK_OF(X509) *recips = NULL;
CMS_ContentInfo *cms = NULL;
- int ret = 1;
+ int ret = EXIT_FAILURE;
/*
* On OpenSSL 1.0.0 and later only:
@@ -73,11 +73,9 @@ int main(int argc, char **argv)
if (!SMIME_write_CMS(out, cms, in, flags))
goto err;
- ret = 0;
-
+ ret = EXIT_SUCCESS;
err:
-
- if (ret) {
+ if (ret != EXIT_SUCCESS) {
fprintf(stderr, "Error Encrypting Data\n");
ERR_print_errors_fp(stderr);
}