summaryrefslogtreecommitdiffstats
path: root/crypto/bio/bss_fd.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-01-24 16:07:51 +0000
committerMatt Caswell <matt@openssl.org>2020-02-20 17:02:31 +0000
commit22623e0cc26a11908253206a721873d4101cd466 (patch)
tree2bf29095d05ad94c39567cd0358ea467d9af6488 /crypto/bio/bss_fd.c
parentdb943f43a60d1b5b1277e4b5317e8f288e7a0a3a (diff)
Teach more BIOs how to handle BIO_CTRL_EOF
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/10882)
Diffstat (limited to 'crypto/bio/bss_fd.c')
-rw-r--r--crypto/bio/bss_fd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/bio/bss_fd.c b/crypto/bio/bss_fd.c
index 894b3ff9e7..76ca0bd887 100644
--- a/crypto/bio/bss_fd.c
+++ b/crypto/bio/bss_fd.c
@@ -123,6 +123,8 @@ static int fd_read(BIO *b, char *out, int outl)
if (ret <= 0) {
if (BIO_fd_should_retry(ret))
BIO_set_retry_read(b);
+ else if (ret == 0)
+ b->flags |= BIO_FLAGS_IN_EOF;
}
}
return ret;
@@ -186,6 +188,9 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
case BIO_CTRL_FLUSH:
ret = 1;
break;
+ case BIO_CTRL_EOF:
+ ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0;
+ break;
default:
ret = 0;
break;