X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=apps%2Fpasswd.c;h=7ae9e8888012f8a92b9b2e976dfb737530c6c382;hp=f0ab24358010acac348767f5ebf2cc88f3374254;hb=4de9913b8c2a11f17258a2ad5e357046fd221360;hpb=b3895f42a9a90a74097c75e39d87ed3212be18dd;ds=sidebyside 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;