Fix from HEAD.
authorDr. Stephen Henson <steve@openssl.org>
Fri, 22 Sep 2006 17:15:04 +0000 (17:15 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 22 Sep 2006 17:15:04 +0000 (17:15 +0000)
apps/enc.c

index 6f3161395ecd863fbb8f0a9067cb708ddb55ef71..368b2aeea6636de92e46e6766404c87d3d976840 100644 (file)
@@ -346,7 +346,7 @@ bad:
                        }
 
                /* It must be large enough for a base64 encoded line */
-               if (n < 80) n=80;
+               if (base64 && n < 80) n=80;
 
                bsize=(int)n;
                if (verbose) BIO_printf(bio_err,"bufsize=%d\n",bsize);
@@ -376,7 +376,11 @@ bad:
                }
 
        if (inf == NULL)
+               {
+               if (bufsize != NULL)
+                       setvbuf(stdin, (char *)NULL, _IONBF, 0);
                BIO_set_fp(in,stdin,BIO_NOCLOSE);
+               }
        else
                {
                if (BIO_read_filename(in,inf) <= 0)
@@ -427,6 +431,8 @@ bad:
        if (outf == NULL)
                {
                BIO_set_fp(out,stdout,BIO_NOCLOSE);
+               if (bufsize != NULL)
+                       setvbuf(stdout, (char *)NULL, _IONBF, 0);
 #ifdef OPENSSL_SYS_VMS
                {
                BIO *tmpbio = BIO_new(BIO_f_linebuffer());