diff options
author | Tomas Mraz <tomas@openssl.org> | 2024-02-08 17:19:19 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2024-03-15 09:07:51 +0100 |
commit | 5c846d32d4a1dc7ee7934bc867b9941809b76beb (patch) | |
tree | 841bd35ce50ff84c4c56d1323806833b62900774 /apps | |
parent | 37cd49f57f9ce4128381ca122b0ac8ca21395265 (diff) | |
download | openssl-5c846d32d4a1dc7ee7934bc867b9941809b76beb.zip openssl-5c846d32d4a1dc7ee7934bc867b9941809b76beb.tar.gz openssl-5c846d32d4a1dc7ee7934bc867b9941809b76beb.tar.bz2 |
apps/x509.c: No warning reading from stdin if redirected
Fixes #22893
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23526)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/x509.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/x509.c b/apps/x509.c index ce3fda6..f77f477 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -25,6 +25,7 @@ #ifndef OPENSSL_NO_DSA # include <openssl/dsa.h> #endif +#include "internal/e_os.h" /* For isatty() */ #undef POSTFIX #define POSTFIX ".srl" @@ -709,7 +710,7 @@ int x509_main(int argc, char **argv) } if (reqfile) { - if (infile == NULL) + if (infile == NULL && isatty(fileno_stdin())) BIO_printf(bio_err, "Warning: Reading cert request from stdin since no -in option is given\n"); req = load_csr_autofmt(infile, informat, vfyopts, @@ -762,7 +763,7 @@ int x509_main(int argc, char **argv) } } } else { - if (infile == NULL) + if (infile == NULL && isatty(fileno_stdin())) BIO_printf(bio_err, "Warning: Reading certificate from stdin since no -in or -new option is given\n"); x = load_cert_pass(infile, informat, 1, passin, "certificate"); |