[openssh-commits] [openssh] 02/05: upstream: In waitfd(), when poll returns early we are subtracting

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Jan 18 18:44:23 AEDT 2021


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 5339ab369c225b40bc64d5ec3374f5c91b3ad609
Author: dtucker at openbsd.org <dtucker at openbsd.org>
Date:   Fri Jan 15 02:32:41 2021 +0000

    upstream: 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@
    
    OpenBSD-Commit-ID: 199df060978ee9aa89b8041a3dfaf1bf7ae8dd7a
---
 misc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/misc.c b/misc.c
index a4a3f2e2..7aad1b5d 100644
--- a/misc.c
+++ b/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.
@@ -297,10 +297,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);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list