提交 27c7609c 编写于 作者: R Rich Salz

ifdef cleanup, 2 remove OPENSSL_NO_SETVBUF_IONBF

Use setbuf(fp, NULL) instead of setvbuf().  This removes some
ifdef complexity because all of our platforms support setbuf.
Reviewed-by: NRichard Levitte <levitte@openssl.org>
上级 9c46f4b9
......@@ -43,6 +43,7 @@
*) Start cleaning up OPENSSL_NO_xxx #define's
OPENSSL_NO_RIPEMD160, OPENSSL_NO_RIPEMD merged into OPENSSL_NO_RMD160
OPENSSL_NO_FP_API merged into OPENSSL_NO_STDIO
Use setbuf() and remove OPENSSL_NO_SETVBUF_IONBF
[Rich Salz]
*) Experimental support for a new, fast, unbiased prime candidate generator,
......
......@@ -852,11 +852,7 @@ X509 *load_cert(BIO *err, const char *file, int format,
}
if (file == NULL) {
#ifdef _IONBF
# ifndef OPENSSL_NO_SETVBUF_IONBF
setvbuf(stdin, NULL, _IONBF, 0);
# endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
#endif
setbuf(stdin, NULL); /* don't do buffered reads */
BIO_set_fp(cert, stdin, BIO_NOCLOSE);
} else {
if (BIO_read_filename(cert, file) <= 0) {
......@@ -980,11 +976,7 @@ EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
goto end;
}
if (file == NULL && maybe_stdin) {
#ifdef _IONBF
# ifndef OPENSSL_NO_SETVBUF_IONBF
setvbuf(stdin, NULL, _IONBF, 0);
# endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
#endif
setbuf(stdin, NULL); /* don't do buffered reads */
BIO_set_fp(key, stdin, BIO_NOCLOSE);
} else if (BIO_read_filename(key, file) <= 0) {
BIO_printf(err, "Error opening %s %s\n", key_descrip, file);
......@@ -1058,11 +1050,7 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
goto end;
}
if (file == NULL && maybe_stdin) {
#ifdef _IONBF
# ifndef OPENSSL_NO_SETVBUF_IONBF
setvbuf(stdin, NULL, _IONBF, 0);
# endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
#endif
setbuf(stdin, NULL); /* don't do buffered reads */
BIO_set_fp(key, stdin, BIO_NOCLOSE);
} else if (BIO_read_filename(key, file) <= 0) {
BIO_printf(err, "Error opening %s %s\n", key_descrip, file);
......
......@@ -396,10 +396,8 @@ int MAIN(int argc, char **argv)
}
if (inf == NULL) {
#ifndef OPENSSL_NO_SETVBUF_IONBF
if (bufsize != NULL)
setvbuf(stdin, (char *)NULL, _IONBF, 0);
#endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
setbuf(stdin, NULL);
BIO_set_fp(in, stdin, BIO_NOCLOSE);
} else {
if (BIO_read_filename(in, inf) <= 0) {
......@@ -442,10 +440,8 @@ int MAIN(int argc, char **argv)
if (outf == NULL) {
BIO_set_fp(out, stdout, BIO_NOCLOSE);
#ifndef OPENSSL_NO_SETVBUF_IONBF
if (bufsize != NULL)
setvbuf(stdout, (char *)NULL, _IONBF, 0);
#endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
setbuf(stdin, NULL); /* don't do buffered reads */
#ifdef OPENSSL_SYS_VMS
{
BIO *tmpbio = BIO_new(BIO_f_linebuffer());
......
......@@ -160,9 +160,7 @@ int RAND_load_file(const char *file, long bytes)
* because we will waste system entropy.
*/
bytes = (bytes == -1) ? 2048 : bytes; /* ok, is 2048 enough? */
# ifndef OPENSSL_NO_SETVBUF_IONBF
setvbuf(in, NULL, _IONBF, 0); /* don't do buffered reads */
# endif /* ndef OPENSSL_NO_SETVBUF_IONBF */
setbuf(stdin, NULL); /* don't do buffered reads */
}
#endif
for (;;) {
......
......@@ -493,14 +493,6 @@ $ GOTO CONFIG_LOG_LOOP2
$ CONFIG_LOG_LOOP2_END:
$!
$ WRITE H_FILE ""
$ WRITE H_FILE "/* 2011-02-23 SMS."
$ WRITE H_FILE " * On VMS (V8.3), setvbuf() doesn't support a 64-bit"
$ WRITE H_FILE " * ""in"" pointer, and the help says:"
$ WRITE H_FILE " * Please note that the previously documented"
$ WRITE H_FILE " * value _IONBF is not supported."
$ WRITE H_FILE " * So, skip it on VMS."
$ WRITE H_FILE " */"
$ WRITE H_FILE "#define OPENSSL_NO_SETVBUF_IONBF"
$ WRITE H_FILE "/* STCP support comes with TCPIP 5.7 ECO 2 "
$ WRITE H_FILE " * enable on newer systems / 2012-02-24 arpadffy */"
$ WRITE H_FILE "#define OPENSSL_NO_SCTP"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册