git: b56bd4c44494 - stable/14 - libfetch: Fix handling of connection failures
Dag-Erling Smørgrav <[email protected]> Sun, 02 Aug 2026 19:55:48 +0000
| Newsgroups | gmane.os.freebsd.devel.cvs.src |
|---|---|
| Message-ID | <6a6fa0c4.27fe8.32d7f07f__5754.83779409609$1785700664$gmane$org@gitrepo.freebsd.org> |
The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=b56bd4c444948f6e353c489cf4f17e0c05dbd46b commit b56bd4c444948f6e353c489cf4f17e0c05dbd46b Author: Mark Johnston <[email protected]> AuthorDate: 2026-07-27 18:58:34 +0000 Commit: Dag-Erling Smørgrav <[email protected]> CommitDate: 2026-08-02 19:55:00 +0000 libfetch: Fix handling of connection failures After commit 848f360c8f9a, if one tries to connect to a closed port, fetch reports "Operation now in progress", which is rather confusing. Return a more useful error message, restoring the old behaviour. Fixes: 848f360c8f9a ("libfetch: Apply timeout to connection attempts") Reviewed by: des MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D58481 (cherry picked from commit b02e02958dad2d5ce3675cbc18b9a94635d09e66) --- lib/libfetch/common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index 31b4997780b2..accb6bec6124 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -682,6 +682,10 @@ fetch_connect(const char *host, int port, int af, int verbose) delta.tv_usec / 1000; } } + if (pfd.revents & POLLHUP) { + errno = ECONNREFUSED; + break; + } if (pfd.revents == POLLOUT) { /* connection established */ err = 0;