Hello,
Attached is a patch for review adding return values of pflocal/io.c for
the case of pipes to detect broken ones. With an upgraded
hurdselect.c:poll() (in the works) the test from e.g. gnulib passes.
Remaning work is to solve the corresponding problem for sockets in
pfinet (and eventually also for pflocal).
Thanks!
--- a/pflocal/io.c 2012-11-06 18:00:09.000000000 +0100
+++ b/pflocal/io.c 2012-11-22 20:00:19.000000000 +0100
@@ -217,6 +217,7 @@ S_io_select (struct sock_user *user,
{
int valid;
int ready = 0;
+ error_t err;
struct pipe *read_pipe = sock->read_pipe;
struct pipe *write_pipe = sock->write_pipe;
@@ -231,15 +232,21 @@ S_io_select (struct sock_user *user,
if (valid & SELECT_READ)
{
pipe_acquire_reader (read_pipe);
- if (pipe_wait_readable (read_pipe, 1, 1) != EWOULDBLOCK)
+ err = pipe_wait_readable (read_pipe, 1, 1);
+ if (err != EWOULDBLOCK)
ready |= SELECT_READ; /* Data immediately readable (or error). */
+ if ((err != 0) && (err != EWOULDBLOCK))
+ return err;
mutex_unlock (&read_pipe->lock);
}
if (valid & SELECT_WRITE)
{
pipe_acquire_writer (write_pipe);
- if (pipe_wait_writable (write_pipe, 1) != EWOULDBLOCK)
+ err = pipe_wait_writable (write_pipe, 1);
+ if (err != EWOULDBLOCK)
ready |= SELECT_WRITE; /* Data immediately writable (or error). */
+ if ((err != 0) && (err != EWOULDBLOCK))
+ return err;
mutex_unlock (&write_pipe->lock);
}
@@ -253,6 +260,8 @@ S_io_select (struct sock_user *user,
{
ports_interrupt_self_on_port_death (user, reply);
err = pipe_pair_select (read_pipe, write_pipe, select_type, 1);
+ if ((err != 0) && (err != EWOULDBLOCK) && (err != EINTR))
+ return err;
}
if (valid & SELECT_READ)