io: fix corner case in EPIPE handling.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 12 Oct 2017 06:33:09 +0000 (17:03 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 12 Oct 2017 06:33:09 +0000 (17:03 +1030)
If io_read is always called, we don't know that it will actually read,
so it might not notice error.  In that case, safest to fail immediately.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/io/io.c

index 7eea9c35442cbbcb4386b430929195d1454b49a0..99f0f7c90fd8580f4dac211134b5ec87da544bf4 100644 (file)
@@ -399,8 +399,7 @@ void io_ready(struct io_conn *conn, int pollflags)
                /* If we're writing to a closed pipe, we need to wait for
                 * read to fail if we're duplex: we want to drain it! */
                do_plan(conn, &conn->plan[IO_OUT],
-                       (conn->plan[IO_IN].status == IO_POLLING
-                        || conn->plan[IO_IN].status == IO_ALWAYS));
+                       conn->plan[IO_IN].status == IO_POLLING);
 }
 
 void io_do_always(struct io_conn *conn)