diff options
author | Richard Levitte <levitte@openssl.org> | 2016-03-31 08:29:39 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2016-03-31 08:31:50 +0200 |
commit | 4de9913b8c2a11f17258a2ad5e357046fd221360 (patch) | |
tree | 4fe7a7fe78c0b24ca13881eb15451fee030c9ed0 /apps/passwd.c | |
parent | b3895f42a9a90a74097c75e39d87ed3212be18dd (diff) | |
download | openssl-4de9913b8c2a11f17258a2ad5e357046fd221360.tar.gz |
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.c | 14 |
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; |