Skip to content

Commit 17fa386

Browse files
committed
v1p: Use VTIM_poll_tmo()
Otherwise poll(2) returns EINVAL on FreeBSD when both pipe_timeout and pipe_task_deadline are disabled. Fixes #4043
1 parent 33e69f0 commit 17fa386

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

bin/varnishd/http1/cache_http1_pipe.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,12 @@ V1P_Process(const struct req *req, int fd, struct v1p_acct *v1a,
149149
fds[1].revents = 0;
150150
tmo = cache_param->pipe_timeout;
151151
if (tmo == 0.)
152-
tmo = -1.;
152+
tmo = NAN;
153153
if (deadline > 0.) {
154154
tmo_task = deadline - VTIM_real();
155-
tmo = (tmo > 0.) ? vmin(tmo, tmo_task) : tmo_task;
156-
tmo = vmax(tmo, 0.);
155+
tmo = vmin(tmo, tmo_task);
157156
}
158-
i = poll(fds, 2, (int)(tmo * 1e3));
157+
i = poll(fds, 2, VTIM_poll_tmo(tmo));
159158
if (i == 0)
160159
sc = SC_RX_TIMEOUT;
161160
if (i < 1)

0 commit comments

Comments
 (0)