apps/mac: avoid need for two ^D when using stdin from a terminal
[openssl.git] / 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)