diff options
| author | slontis <shane.lontis@oracle.com> | 2023-03-20 14:48:33 +1000 |
|---|---|---|
| committer | Tomas Mraz <tomas@openssl.org> | 2023-04-24 14:39:19 +0200 |
| commit | 09ff84bd2752cac649f57cfbf95b49dbce1c69ee (patch) | |
| tree | 9a3dbf4aa9835f2be7d874cde743f6dfa1de6293 /demos/encode/ec_encode.c | |
| parent | a80840c663e3409203b0235764e53d8624f74cb8 (diff) | |
| download | openssl-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/encode/ec_encode.c')
| -rw-r--r-- | demos/encode/ec_encode.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/demos/encode/ec_encode.c b/demos/encode/ec_encode.c index 8c296fbad8..a5fe2213df 100644 --- a/demos/encode/ec_encode.c +++ b/demos/encode/ec_encode.c @@ -28,7 +28,7 @@ static const char *propq = NULL; */ static EVP_PKEY *load_key(OSSL_LIB_CTX *libctx, FILE *f, const char *passphrase) { - int rv = 0; + int ret = 0; EVP_PKEY *pkey = NULL; OSSL_DECODER_CTX *dctx = NULL; int selection = 0; @@ -75,7 +75,7 @@ static EVP_PKEY *load_key(OSSL_LIB_CTX *libctx, FILE *f, const char *passphrase) goto cleanup; } - rv = 1; + ret = 1; cleanup: OSSL_DECODER_CTX_free(dctx); @@ -84,7 +84,7 @@ cleanup: * might fail subsequently, so ensure it's properly freed * in this case. */ - if (rv == 0) { + if (ret == 0) { EVP_PKEY_free(pkey); pkey = NULL; } @@ -100,7 +100,7 @@ cleanup: */ static int store_key(EVP_PKEY *pkey, FILE *f, const char *passphrase) { - int rv = 0; + int ret = 0; int selection; OSSL_ENCODER_CTX *ectx = NULL; @@ -165,15 +165,15 @@ static int store_key(EVP_PKEY *pkey, FILE *f, const char *passphrase) goto cleanup; } - rv = 1; + ret = 1; cleanup: OSSL_ENCODER_CTX_free(ectx); - return rv; + return ret; } int main(int argc, char **argv) { - int rv = 1; + int ret = EXIT_FAILURE; OSSL_LIB_CTX *libctx = NULL; EVP_PKEY *pkey = NULL; const char *passphrase_in = NULL, *passphrase_out = NULL; @@ -197,9 +197,9 @@ int main(int argc, char **argv) goto cleanup; } - rv = 0; + ret = EXIT_SUCCESS; cleanup: EVP_PKEY_free(pkey); OSSL_LIB_CTX_free(libctx); - return rv; + return ret; } |
