BIO_write_ex(): Make handing of BIO b == NULL and dlen == 0 less redundant
@@ -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)
