summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ssh-keyscan.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index a5e644076..ca190428a 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keyscan.c,v 1.131 2019/12/15 19:47:10 djm Exp $ */ 1/* $OpenBSD: ssh-keyscan.c,v 1.132 2020/08/12 01:23:45 cheloha Exp $ */
2/* 2/*
3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. 3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
4 * 4 *
@@ -584,16 +584,9 @@ conloop(void)
584 monotime_tv(&now); 584 monotime_tv(&now);
585 c = TAILQ_FIRST(&tq); 585 c = TAILQ_FIRST(&tq);
586 586
587 if (c && (c->c_tv.tv_sec > now.tv_sec || 587 if (c && timercmp(&c->c_tv, &now, >))
588 (c->c_tv.tv_sec == now.tv_sec && c->c_tv.tv_usec > now.tv_usec))) { 588 timersub(&c->c_tv, &now, &seltime);
589 seltime = c->c_tv; 589 else
590 seltime.tv_sec -= now.tv_sec;
591 seltime.tv_usec -= now.tv_usec;
592 if (seltime.tv_usec < 0) {
593 seltime.tv_usec += 1000000;
594 seltime.tv_sec--;
595 }
596 } else
597 timerclear(&seltime); 590 timerclear(&seltime);
598 591
599 r = xcalloc(read_wait_nfdset, sizeof(fd_mask)); 592 r = xcalloc(read_wait_nfdset, sizeof(fd_mask));
@@ -616,8 +609,7 @@ conloop(void)
616 free(e); 609 free(e);
617 610
618 c = TAILQ_FIRST(&tq); 611 c = TAILQ_FIRST(&tq);
619 while (c && (c->c_tv.tv_sec < now.tv_sec || 612 while (c && timercmp(&c->c_tv, &now, <)) {
620 (c->c_tv.tv_sec == now.tv_sec && c->c_tv.tv_usec < now.tv_usec))) {
621 int s = c->c_fd; 613 int s = c->c_fd;
622 614
623 c = TAILQ_NEXT(c, c_link); 615 c = TAILQ_NEXT(c, c_link);