diff options
author | Bodo Möller <bodo@openssl.org> | 2002-03-14 09:48:54 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2002-03-14 09:48:54 +0000 |
commit | 234c73767daf1dfadbdbff3f884d7cfffff2846c (patch) | |
tree | d5bec6702d0af7a20d491ac27e9ec5c846eb6106 /ssl/ssltest.c | |
parent | 497810cae78a5beb8560a851f9a6800dfbbc0cbb (diff) |
use BIO_nwrite() more properly to demonstrate the general idea of
BIO_nwrite0/BIO_nwrite (the previous code was OK for BIO pairs but not
in general)
Diffstat (limited to 'ssl/ssltest.c')
-rw-r--r-- | ssl/ssltest.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ssl/ssltest.c b/ssl/ssltest.c index 2ef9ae7601..f98202945e 100644 --- a/ssl/ssltest.c +++ b/ssl/ssltest.c @@ -1053,10 +1053,10 @@ int doit_biopair(SSL *s_ssl, SSL *c_ssl, long count, if (num > 1) --num; /* test restartability even more thoroughly */ - r = BIO_nwrite(io1, &dataptr, (int)num); + r = BIO_nwrite0(io1, &dataptr); assert(r > 0); - assert(r <= (int)num); - num = r; + if (r < num) + num = r; r = BIO_read(io2, dataptr, (int)num); if (r != (int)num) /* can't happen */ { @@ -1065,6 +1065,13 @@ int doit_biopair(SSL *s_ssl, SSL *c_ssl, long count, goto err; } progress = 1; + r = BIO_nwrite(io1, &dataptr, (int)num); + if (r != (int)num) /* can't happen */ + { + fprintf(stderr, "ERROR: BIO_nwrite() did not accept " + "BIO_nwrite0() bytes"); + goto err; + } if (debug) printf((io2 == client_io) ? |