summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2021-06-12 11:49:22 +0200
committerDr. David von Oheimb <dev@ddvo.net>2021-06-15 14:23:29 +0200
commitbb19b9d4561228599b2259f6a4912066274ae622 (patch)
tree941976795afd96e94c14f14574bbdc24d89d61a7 /crypto
parent1d8897176d06eeb88738182dbd4ad08df2f045e9 (diff)
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)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bio/bio_lib.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c
index af7ad05bca..a378f186d7 100644
--- a/crypto/bio/bio_lib.c
+++ b/crypto/bio/bio_lib.c
@@ -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)