The branch releng/14.4 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=8755b5f3a590560996fb122abe22644d3be3836a
commit 8755b5f3a590560996fb122abe22644d3be3836a Author: Dag-Erling Smørgrav <[email protected]> AuthorDate: 2026-02-18 15:10:47 +0000 Commit: Colin Percival <[email protected]> CommitDate: 2026-02-19 19:21:21 +0000 libfetch: Restore timeout functionality PR: 293124 MFC after: 1 week Fixes: 792ef1ae7b94 ("Refactor fetch_connect() and fetch_bind() to improve readability and avoid repeating the same DNS lookups.") Reverts: 8f8a7f6fffd7 ("libfetch: apply timeout to SSL_read()") Reviewed by: eugen, imp Differential Revision: https://reviews.freebsd.org/D55293 (cherry picked from commit 73b82d1b0a2f09224e6d0f7a13dd73c66d740207) (insta-mfc requested by re@) (cherry picked from commit d97c824f5b4c9e7e3a1400699022cba146e450fa) --- lib/libfetch/common.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index d5423d8eb5d1..bdc72f67c9a0 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -287,6 +287,9 @@ fetch_reopen(int sd) flags = fcntl(sd, F_GETFD); if (flags != -1 && (flags & FD_CLOEXEC) == 0) (void)fcntl(sd, F_SETFD, flags | FD_CLOEXEC); + flags = fcntl(sd, F_GETFL); + if (flags != -1 && (flags & O_NONBLOCK) == 0) + (void)fcntl(sd, F_SETFL, flags | O_NONBLOCK); (void)setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt)); conn->sd = sd; ++conn->ref; @@ -1272,14 +1275,6 @@ fetch_ssl_read(SSL *ssl, char *buf, size_t len) { ssize_t rlen; int ssl_err; - struct timeval tv; - - if (fetchTimeout > 0) { - tv.tv_sec = fetchTimeout; - tv.tv_usec = 0; - setsockopt(SSL_get_fd(ssl), SOL_SOCKET, SO_RCVTIMEO, - &tv, sizeof(tv)); - } rlen = SSL_read(ssl, buf, len); if (rlen < 0) {
