From 6d53ad6b5cf726d92860e973d7bc8c1930762086 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 24 Jan 2020 16:07:51 +0000 Subject: Teach more BIOs how to handle BIO_CTRL_EOF Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/10907) --- crypto/bio/bss_fd.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crypto/bio/bss_fd.c') diff --git a/crypto/bio/bss_fd.c b/crypto/bio/bss_fd.c index 9db3317e9a..599790d654 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; -- cgit v1.2.3