iputils/backport-clockdiff-Set-ppoll-timeout-minimum-to-1ms.patch
2024-04-01 07:37:15 +00:00

28 lines
991 B
Diff

From 471942dee341e5aae2a277ecd85c05e671752880 Mon Sep 17 00:00:00 2001
From: caibingcheng <jack_cbc@163.com>
Date: Mon, 24 Apr 2023 20:45:28 +0800
Subject: [PATCH] clockdiff: Set ppoll timeout minimum to 1ms
Fixes: https://github.com/iputils/iputils/issues/326
Closes: https://github.com/iputils/iputils/pull/459
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Noah Meyerhans <noahm@debian.org>
Signed-off-by: caibingcheng <jack_cbc@163.com>
---
clockdiff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clockdiff.c b/clockdiff.c
index 5e639ab7..ccb5b5b3 100644
--- a/clockdiff.c
+++ b/clockdiff.c
@@ -210,7 +210,7 @@ static int measure_inner_loop(struct run_state *ctl, struct measure_vars *mv)
struct pollfd p = { .fd = ctl->sock_raw, .events = POLLIN | POLLHUP };
{
- long tmo = ctl->rtt + ctl->rtt_sigma;
+ long tmo = MAX(ctl->rtt + ctl->rtt_sigma, 1);
mv->tout.tv_sec = tmo / 1000;
mv->tout.tv_nsec = (tmo - (tmo / 1000) * 1000) * 1000000;