From: Ian Jackson Date: Sun, 27 Nov 2016 17:54:02 +0000 (+0000) Subject: regress: fuzzraw: Handle select and poll return value specially X-Git-Tag: adns-1.6.0~58 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=817bb41e2d62e85c36e490c615466a276fc17d22;p=adns.git regress: fuzzraw: Handle select and poll return value specially Don't read or write it to the fuzzraw stream. Instead, in hfuzzraw, calculate it from the returned fd set (and check it's consistent with the timeout). Signed-off-by: Ian Jackson --- diff --git a/regress/hfuzzraw.c.m4 b/regress/hfuzzraw.c.m4 index 6984c8b..3dad087 100644 --- a/regress/hfuzzraw.c.m4 +++ b/regress/hfuzzraw.c.m4 @@ -137,7 +137,7 @@ static int Pbytes(byte *buf, int maxlen) { return l; } -static void Pfdset(fd_set *set, int max) { +static void Pfdset(fd_set *set, int max, int *r_io) { uint16_t got; int fd, ngot=0; @@ -148,7 +148,9 @@ static void Pfdset(fd_set *set, int max) { P_READ(got); ngot= 16; } - if (!(got & 1u)) { + if (got & 1u) { + (*r_io)++; + } else { FD_CLR(fd,set); } got >>= 1; @@ -157,12 +159,14 @@ static void Pfdset(fd_set *set, int max) { } #ifdef HAVE_POLL -static void Ppollfds(struct pollfd *fds, int nfds) { -int fd; +static void Ppollfds(struct pollfd *fds, int nfds, int *r_io) { + int fd; for (fd=0; fd