From 6cb1b4e89eb29a90c7a98575abe27d86d29c44bd Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Mon, 14 Oct 2024 13:26:07 +0200 Subject: [PATCH] SSL_poll(): Handle blocking with no poll items MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Matt Caswell Reviewed-by: Saša Nedvědický (Merged from https://github.com/openssl/openssl/pull/25416) --- ssl/rio/poll_immediate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ssl/rio/poll_immediate.c b/ssl/rio/poll_immediate.c index 76b2db7a807..fb18e9e5fea 100644 --- a/ssl/rio/poll_immediate.c +++ b/ssl/rio/poll_immediate.c @@ -412,8 +412,12 @@ int SSL_poll(SSL_POLL_ITEM *items, OSSL_TIME deadline; /* Trivial case. */ - if (num_items == 0) + if (num_items == 0) { + if (timeout == NULL) + goto out; + OSSL_sleep(ossl_time2ms(ossl_time_from_timeval(*timeout))); goto out; + } /* Convert timeout to deadline. */ if (timeout == NULL) -- 2.47.2