From 645749ef98612340b11c4bf2ba856e1fa469912b Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 20 Sep 2000 13:55:50 +0000 Subject: On VMS, stdout may very well lead to a file that is written to in a record-oriented fashion. That means that every write() will write a separate record, which will be read separately by the programs trying to read from it. This can be very confusing. The solution is to put a BIO filter in the way that will buffer text until a linefeed is reached, and then write everything a line at a time, so every record written will be an actual line, not chunks of lines and not (usually doesn't happen, but I've seen it once) several lines in one record. Voila, BIO_f_linebuffer() is born. Since we're so close to release time, I'm making this VMS-only for now, just to make sure no code is needlessly broken by this. After the release, this BIO method will be enabled on all other platforms as well. --- apps/pkcs12.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'apps/pkcs12.c') diff --git a/apps/pkcs12.c b/apps/pkcs12.c index 070993de30..6789169bdb 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -350,8 +350,15 @@ int MAIN(int argc, char **argv) CRYPTO_push_info("write files"); #endif - if (!outfile) out = BIO_new_fp(stdout, BIO_NOCLOSE); - else out = BIO_new_file(outfile, "wb"); + if (!outfile) { + out = BIO_new_fp(stdout, BIO_NOCLOSE); +#ifdef VMS + { + BIO *tmpbio = BIO_new(BIO_f_linebuffer()); + out = BIO_push(tmpbio, out); + } +#endif + } else out = BIO_new_file(outfile, "wb"); if (!out) { BIO_printf(bio_err, "Error opening output file %s\n", outfile ? outfile : ""); @@ -657,7 +664,7 @@ int MAIN(int argc, char **argv) CRYPTO_remove_all_info(); #endif BIO_free(in); - BIO_free(out); + BIO_free_all(out); if (canames) sk_free(canames); if(passin) OPENSSL_free(passin); if(passout) OPENSSL_free(passout); -- cgit v1.2.3