From 817bb41e2d62e85c36e490c615466a276fc17d22 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 27 Nov 2016 17:54:02 +0000 Subject: [PATCH] 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 --- regress/hfuzzraw.c.m4 | 26 ++++++++++++++++++++------ regress/hplayback.c.m4 | 2 ++ 2 files changed, 22 insertions(+), 6 deletions(-) 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