Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apps/x509.c: No warning reading from stdin if redirected #23526

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions include/internal/e_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ FILE *__iob_func(void);
# endif
# define unlink _unlink
# define fileno _fileno
# define isatty _isatty
# endif
# else
# include <strings.h>
Expand Down