diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2023-08-04 06:32:40 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2023-08-04 17:50:35 +1000 |
commit | e535fbe2af893046c28adfcd787c1fdbae36a24a (patch) | |
tree | 86b7c0acd2a554e98018d0e0d71e22d81008083d /misc.c | |
parent | 9d92e7b24848fcc605945f7c2e3460c7c31832ce (diff) |
upstream: Apply ConnectTimeout to multiplexing local socket
connections. If the multiplex socket exists but the connection times out,
ssh will fall back to a direct connection the same way it would if the socket
did not exist at all. ok djm@
OpenBSD-Commit-ID: 2fbe1a36d4a24b98531b2d298a6557c8285dc1b4
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.184 2023/07/19 14:02:27 djm Exp $ */ +/* $OpenBSD: misc.c,v 1.185 2023/08/04 06:32:40 dtucker Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2005-2020 Damien Miller. All rights reserved. @@ -317,15 +317,16 @@ waitfd(int fd, int *timeoutp, short events) { struct pollfd pfd; struct timeval t_start; - int oerrno, r; + int oerrno, r, have_timeout = (*timeoutp >= 0); pfd.fd = fd; pfd.events = events; - for (; *timeoutp >= 0;) { + for (; !have_timeout || *timeoutp >= 0;) { monotime_tv(&t_start); r = poll(&pfd, 1, *timeoutp); oerrno = errno; - ms_subtract_diff(&t_start, timeoutp); + if (have_timeout) + ms_subtract_diff(&t_start, timeoutp); errno = oerrno; if (r > 0) return 0; |