Assert that, for POLLIN received, there actually is data to be read

parent 69d0f64a
...@@ -473,17 +473,12 @@ vdp_bytes(struct vdp_ctx *ctx, enum vdp_action act, void **priv, ...@@ -473,17 +473,12 @@ vdp_bytes(struct vdp_ctx *ctx, enum vdp_action act, void **priv,
close_all(fds); close_all(fds);
return (-1); return (-1);
} }
assert(nbytes > 0);
if (i == STDOUT_FILENO && if (i == STDOUT_FILENO &&
fds[i].revents & POLLHUP && fds[i].revents & POLLHUP &&
nbytes < obj->bufsz) { nbytes < obj->bufsz) {
act_bytes = VDP_END; act_bytes = VDP_END;
} }
if (nbytes == 0) {
if (i == STDOUT_FILENO)
closefd(&fds[STDOUT_FILENO].fd);
else
closefd(&fds[STDERR_FILENO].fd);
}
if (i == STDOUT_FILENO) { if (i == STDOUT_FILENO) {
retval = VDP_bytes(ctx, act_bytes, state->buf, retval = VDP_bytes(ctx, act_bytes, state->buf,
nbytes); nbytes);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment