Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

Commit

Permalink
A zero timeout in the VCLI functions should mean "infinity".
Browse files Browse the repository at this point in the history
This fixes "varnishadm -t 0"
  • Loading branch information
bsdphk committed Jun 2, 2011
1 parent 31a65a9 commit 4ea9641
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/libvarnish/cli_common.c
Expand Up @@ -118,13 +118,17 @@ VCLI_WriteResult(int fd, const struct cli *cli)
static int
read_tmo(int fd, char *ptr, unsigned len, double tmo)
{
int i, j;
int i, j, to;
struct pollfd pfd;

if (tmo > 0)
to = tmo * 1e3;
else
to = -1;
pfd.fd = fd;
pfd.events = POLLIN;
for (j = 0; len > 0; ) {
i = poll(&pfd, 1, (int)(tmo * 1e3));
i = poll(&pfd, 1, to);
if (i == 0) {
errno = ETIMEDOUT;
return (-1);
Expand Down

0 comments on commit 4ea9641

Please sign in to comment.