summaryrefslogtreecommitdiffstats
path: root/apps/passwd.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-03-31 08:29:39 +0200
committerRichard Levitte <levitte@openssl.org>2016-03-31 08:31:50 +0200
commit4de9913b8c2a11f17258a2ad5e357046fd221360 (patch)
tree4fe7a7fe78c0b24ca13881eb15451fee030c9ed0 /apps/passwd.c
parentRemove the CRYPTO_mem_leaks adjustment for the BIO (diff)
downloadopenssl-4de9913b8c2a11f17258a2ad5e357046fd221360.tar.xz
openssl-4de9913b8c2a11f17258a2ad5e357046fd221360.zip
Make the '-in' option in apps/passwd.c less mandatory
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'apps/passwd.c')
-rw-r--r--apps/passwd.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/apps/passwd.c b/apps/passwd.c
index f0ab243580..7ae9e88880 100644
--- a/apps/passwd.c
+++ b/apps/passwd.c
@@ -201,14 +201,20 @@ int passwd_main(int argc, char **argv)
goto opthelp;
# endif
- if (infile && in_stdin) {
+ if (infile != NULL && in_stdin) {
BIO_printf(bio_err, "%s: Can't combine -in and -stdin\n", prog);
goto end;
}
- in = bio_open_default(infile, 'r', FORMAT_TEXT);
- if (in == NULL)
- goto end;
+ if (infile != NULL || in_stdin) {
+ /*
+ * If in_stdin is true, we know that infile is NULL, and that
+ * bio_open_default() will give us back an alias for stdin.
+ */
+ in = bio_open_default(infile, 'r', FORMAT_TEXT);
+ if (in == NULL)
+ goto end;
+ }
if (usecrypt)
pw_maxlen = 8;