apps/mac: avoid need for two ^D when using stdin from a terminal
authorPauli <pauli@openssl.org>
Fri, 7 May 2021 04:19:06 +0000 (14:19 +1000)
committerPauli <pauli@openssl.org>
Sat, 8 May 2021 12:15:56 +0000 (22:15 +1000)
Fixes #13246

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15189)

apps/mac.c

index dccbb681172bf571131965c0c42c98e453bf9fad..b9610f3a185f780696777e4ef5321499572ec122 100644 (file)
@@ -150,10 +150,11 @@ opthelp:
         goto err;
     }
 
-    for (;;) {
+    while (BIO_pending(in) || !BIO_eof(in)) {
         i = BIO_read(in, (char *)buf, BUFSIZE);
         if (i < 0) {
             BIO_printf(bio_err, "Read Error in '%s'\n", infile);
+            ERR_print_errors(bio_err);
             goto err;
         }
         if (i == 0)