Just call the rrdp_data_handler() whenever a poll event happened.
The read() call will do the right thing then even on a POLLHUP event.
It seems that on Linux systems POLLHUP is returned when a socket is closed
while OpenBSD returns POLLIN. In both cases read() returns 0 which is what
we want.
--
:wq Claudio
Index: rrdp.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/rrdp.c,v
retrieving revision 1.4
diff -u -p -r1.4 rrdp.c
--- rrdp.c 12 Apr 2021 17:23:30 -0000 1.4
+++ rrdp.c 15 Apr 2021 08:41:38 -0000
@@ -579,7 +579,7 @@ proc_rrdp(int fd)
TAILQ_FOREACH_SAFE(s, &states, entry, ns) {
if (s->pfd == NULL)
continue;
- if (s->pfd->revents & POLLIN)
+ if (s->pfd->revents != 0)
rrdp_data_handler(s);
}
}