1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 03:30:27 +02:00

'select' returns empty sets upon EINTR and EAGAIN.

Fixes <https://bugs.gnu.org/30368>.

* libguile/filesys.c (scm_select): Clear READ_SET, WRITE_SET, and
EXCEPT_SET when RV < 0.
This commit is contained in:
Ludovic Courtès 2018-02-16 14:05:04 +01:00 committed by Andy Wingo
parent 2245c67c37
commit 666f12c871

View file

@ -906,10 +906,20 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0,
int rv = scm_std_select (max_fd + 1,
&read_set, &write_set, &except_set,
time_ptr);
/* Let EINTR / EAGAIN cause a return to the user and let them loop
to run any asyncs that might be pending. */
if (rv < 0 && errno != EINTR && errno != EAGAIN)
SCM_SYSERROR;
if (rv < 0)
{
/* Let EINTR / EAGAIN cause a return to the user and let them
loop to run any asyncs that might be pending. */
if (errno != EINTR && errno != EAGAIN)
SCM_SYSERROR;
else
{
/* Return empty sets. */
FD_ZERO (&read_set);
FD_ZERO (&write_set);
FD_ZERO (&except_set);
}
}
}
return scm_list_3 (retrieve_select_type (&read_set, read_ports_ready, reads),