summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordtucker <dtucker@openbsd.org>2021-01-15 02:32:41 +0000
committerdtucker <dtucker@openbsd.org>2021-01-15 02:32:41 +0000
commit9f2271df49ace26aea2d2a68fef47616d3ef9574 (patch)
treec13718783d8acbab1c0827f16d6b2184cf82ef53
parentIPv4 loopback addresses do not work with af-to as in_canforward() (diff)
downloadwireguard-openbsd-9f2271df49ace26aea2d2a68fef47616d3ef9574.tar.xz
wireguard-openbsd-9f2271df49ace26aea2d2a68fef47616d3ef9574.zip
In waitfd(), when poll returns early we are subtracting the elapsed time
from the timeout each loop, so we only want to measure the elapsed time the poll() in that loop, not since the start of the function. Spotted by chris.xj.zhu at gmail.com, ok djm@
-rw-r--r--usr.bin/ssh/misc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index 4bd938d421d..f793ec9f33e 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.158 2021/01/11 02:12:57 dtucker Exp $ */
+/* $OpenBSD: misc.c,v 1.159 2021/01/15 02:32:41 dtucker Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
@@ -259,10 +259,10 @@ waitfd(int fd, int *timeoutp, short events)
struct timeval t_start;
int oerrno, r;
- monotime_tv(&t_start);
pfd.fd = fd;
pfd.events = events;
for (; *timeoutp >= 0;) {
+ monotime_tv(&t_start);
r = poll(&pfd, 1, *timeoutp);
oerrno = errno;
ms_subtract_diff(&t_start, timeoutp);