From 444d615ad32c40790414e6954a75424059cfcb0c Mon Sep 17 00:00:00 2001 From: Dridi Boukelmoune Date: Thu, 1 Feb 2024 09:20:33 +0100 Subject: [PATCH] v1p: Use VTIM_poll_tmo() Otherwise poll(2) returns EINVAL on FreeBSD when both pipe_timeout and pipe_task_deadline are disabled. Fixes #4043 --- bin/varnishd/http1/cache_http1_pipe.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bin/varnishd/http1/cache_http1_pipe.c b/bin/varnishd/http1/cache_http1_pipe.c index 7ffe4b68cbc..98464ab462d 100644 --- a/bin/varnishd/http1/cache_http1_pipe.c +++ b/bin/varnishd/http1/cache_http1_pipe.c @@ -149,13 +149,12 @@ V1P_Process(const struct req *req, int fd, struct v1p_acct *v1a, fds[1].revents = 0; tmo = cache_param->pipe_timeout; if (tmo == 0.) - tmo = -1.; + tmo = NAN; if (deadline > 0.) { tmo_task = deadline - VTIM_real(); - tmo = (tmo > 0.) ? vmin(tmo, tmo_task) : tmo_task; - tmo = vmax(tmo, 0.); + tmo = vmin(tmo, tmo_task); } - i = poll(fds, 2, (int)(tmo * 1e3)); + i = poll(fds, 2, VTIM_poll_tmo(tmo)); if (i == 0) sc = SC_RX_TIMEOUT; if (i < 1)