mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-30 23:10:21 +02:00
Fix POLLOUT assignment from port buffers
* libguile/poll.c (scm_primitive_poll): A buffered port's buffer marks it as writable only when writing a byte would not block, which is the case only if there is more than one byte free in the buffer; writing the last byte would block.
This commit is contained in:
parent
b77fb752dd
commit
4bd9038925
1 changed files with 8 additions and 4 deletions
|
@ -111,8 +111,10 @@ scm_primitive_poll (SCM pollfds, SCM nfds, SCM ports, SCM timeout)
|
|||
if (pt->read_pos < pt->read_end)
|
||||
/* Buffered input waiting to be read. */
|
||||
revents |= POLLIN;
|
||||
if (pt->write_pos < pt->write_end)
|
||||
/* Buffered output possible. */
|
||||
if (SCM_OUTPUT_PORT_P (port)
|
||||
&& pt->write_end - pt->write_pos > 1)
|
||||
/* Buffered output possible. The "> 1" is because
|
||||
writing the last byte would flush the port. */
|
||||
revents |= POLLOUT;
|
||||
}
|
||||
}
|
||||
|
@ -147,8 +149,10 @@ scm_primitive_poll (SCM pollfds, SCM nfds, SCM ports, SCM timeout)
|
|||
if (pt->read_pos < pt->read_end)
|
||||
/* Buffered input waiting to be read. */
|
||||
revents |= POLLIN;
|
||||
if (SCM_OUTPUT_PORT_P (port) && pt->write_pos < pt->write_end)
|
||||
/* Buffered output possible. */
|
||||
if (SCM_OUTPUT_PORT_P (port)
|
||||
&& pt->write_end - pt->write_pos > 1)
|
||||
/* Buffered output possible. The "> 1" is because
|
||||
writing the last byte would flush the port. */
|
||||
revents |= POLLOUT;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue