From ed3d011490736316a8ee7b905d1b925e862fe4ed Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 25 Nov 2021 12:55:34 +0000 Subject: [PATCH] Check for possible negative diff timeout. Clamp it to 0 in that case. poll with negative timeout noticed by job@ OK job@ --- usr.sbin/rpki-client/repo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/rpki-client/repo.c b/usr.sbin/rpki-client/repo.c index 5d8ecdefd64..5c6aa5f17dd 100644 --- a/usr.sbin/rpki-client/repo.c +++ b/usr.sbin/rpki-client/repo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: repo.c,v 1.12 2021/11/15 16:32:15 claudio Exp $ */ +/* $OpenBSD: repo.c,v 1.13 2021/11/25 12:55:34 claudio Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -1213,6 +1213,8 @@ repo_next_timeout(int timeout) SLIST_FOREACH(rp, &repos, entry) { if (repo_state(rp) == REPO_LOADING) { int diff = rp->alarm - now; + if (diff < 0) + diff = 0; diff *= 1000; if (timeout == INFTIM || diff < timeout) timeout = diff; -- 2.20.1