mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
fix bugs in primitive-poll
* libguile/poll.c (scm_primitive_poll): Only mark POLLOUT for output ports. Don't override results from the syscall, add to them.
This commit is contained in:
parent
998191fd4f
commit
557abc4978
1 changed files with 13 additions and 3 deletions
|
@ -151,14 +151,24 @@ scm_primitive_poll (SCM pollfds, SCM nfds, SCM ports, SCM timeout)
|
||||||
if (pt->read_pos < pt->read_end)
|
if (pt->read_pos < pt->read_end)
|
||||||
/* Buffered input waiting to be read. */
|
/* Buffered input waiting to be read. */
|
||||||
revents |= POLLIN;
|
revents |= POLLIN;
|
||||||
if (pt->write_pos < pt->write_end)
|
if (SCM_OUTPUT_PORT_P (port) && pt->write_pos < pt->write_end)
|
||||||
/* Buffered output possible. */
|
/* Buffered output possible. */
|
||||||
revents |= POLLOUT;
|
revents |= POLLOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fds[i].revents = revents & fds[i].events))
|
/* Mask in the events we are interested, and test if any are
|
||||||
rv++;
|
interesting. */
|
||||||
|
if ((revents &= fds[i].events))
|
||||||
|
{
|
||||||
|
/* Could be the underlying fd is also ready for reading. */
|
||||||
|
if (!fds[i].revents)
|
||||||
|
rv++;
|
||||||
|
|
||||||
|
/* In any case, add these events to whatever the syscall
|
||||||
|
set. */
|
||||||
|
fds[i].revents |= revents;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return scm_from_int (rv);
|
return scm_from_int (rv);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue