summaryrefslogtreecommitdiffstats
path: root/demos/pkcs12
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/pkcs12
parenta80840c663e3409203b0235764e53d8624f74cb8 (diff)
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/pkcs12')
-rw-r--r--demos/pkcs12/pkwrite.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/demos/pkcs12/pkwrite.c b/demos/pkcs12/pkwrite.c
index 51afd25a26..214ab5cbac 100644
--- a/demos/pkcs12/pkwrite.c
+++ b/demos/pkcs12/pkwrite.c
@@ -23,13 +23,13 @@ int main(int argc, char **argv)
PKCS12 *p12;
if (argc != 5) {
fprintf(stderr, "Usage: pkwrite infile password name p12file\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
if ((fp = fopen(argv[1], "r")) == NULL) {
fprintf(stderr, "Error opening file %s\n", argv[1]);
- exit(1);
+ exit(EXIT_FAILURE);
}
cert = PEM_read_X509(fp, NULL, NULL, NULL);
rewind(fp);
@@ -39,15 +39,15 @@ int main(int argc, char **argv)
if (!p12) {
fprintf(stderr, "Error creating PKCS#12 structure\n");
ERR_print_errors_fp(stderr);
- exit(1);
+ exit(EXIT_FAILURE);
}
if ((fp = fopen(argv[4], "wb")) == NULL) {
fprintf(stderr, "Error opening file %s\n", argv[4]);
ERR_print_errors_fp(stderr);
- exit(1);
+ exit(EXIT_FAILURE);
}
i2d_PKCS12_fp(fp, p12);
PKCS12_free(p12);
fclose(fp);
- return 0;
+ return EXIT_SUCCESS;
}