BIO_write_ex(): Make handing of BIO b == NULL and dlen == 0 less redundant

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15722)
This commit is contained in:
Dr. David von Oheimb 2021-06-12 11:49:22 +02:00 committed by Dr. David von Oheimb
parent 1d8897176d
commit bb19b9d456

View File

@ -393,13 +393,8 @@ int BIO_write(BIO *b, const void *data, int dlen)
int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written)
{
if (dlen == 0) {
/* no error */
if (written != NULL)
*written = 0;
return 1;
}
return bio_write_intern(b, data, dlen, written) > 0;
return bio_write_intern(b, data, dlen, written) > 0
|| (b != NULL && dlen == 0); /* order is important for *written */
}
int BIO_puts(BIO *b, const char *buf)