mirror of
https://github.com/openssl/openssl.git
synced 2025-01-30 14:01:55 +08:00
[apps/genpkey] exit status should not be 0 on output errors
If the key is to be serialized or printed as text and the framework returns an error, the app should signal the failure to the user using a non-zero exit status. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12305)
This commit is contained in:
parent
e0137ca92b
commit
466d30c0d7
@ -189,9 +189,12 @@ int genpkey_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
if (rv <= 0) {
|
||||
BIO_puts(bio_err, "Error writing key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
if (text) {
|
||||
@ -203,11 +206,10 @@ int genpkey_main(int argc, char **argv)
|
||||
if (rv <= 0) {
|
||||
BIO_puts(bio_err, "Error printing key\n");
|
||||
ERR_print_errors(bio_err);
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
end:
|
||||
EVP_PKEY_free(pkey);
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user