commit - e9f1a409ccc66a6fb79a3022695ca78ad26972ea
commit + 3e54812463cc8a33236c16a18d1361597e516d71
blob - c0b028f2df10a4790b2d55637533cce65b42ab06
blob + d0da0d1326d22a856516386bcc38b06f9e55d415
--- lib/privsep.c
+++ lib/privsep.c
const struct got_error *err;
size_t n;
- err = poll_fd(ibuf->fd, POLLIN, INFTIM);
- if (err)
- return err;
+ /*
+ * There is no imsg API function to tell us whether the
+ * read buffer still contains pending data :-(
+ */
+ if (ibuf->r.wpos < IMSG_HEADER_SIZE) {
+ err = poll_fd(ibuf->fd, POLLIN, INFTIM);
+ if (err)
+ return err;
+ }
n = imsg_read(ibuf);
if (n == -1) {