X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2Ftest%2Frun-08-read-after-hangup.c;h=f6b3db1cb9fd45338d57b5012c00ca9a38a9197e;hb=b7e880755a5fad76f876bec31d6eabd0c5284151;hp=b73139e4f4c7a256c1e00301dce63c67622c1869;hpb=13b38a7282c6043d6abe310e5a16d6610ed7a1c1;p=ccan diff --git a/ccan/io/test/run-08-read-after-hangup.c b/ccan/io/test/run-08-read-after-hangup.c index b73139e4..f6b3db1c 100644 --- a/ccan/io/test/run-08-read-after-hangup.c +++ b/ccan/io/test/run-08-read-after-hangup.c @@ -11,10 +11,15 @@ static char inbuf[8]; static struct io_plan wake_it(struct io_conn *conn, struct io_conn *reader) { - io_wake(reader, io_read(inbuf, 8, io_close_cb, NULL)); + io_wake(inbuf); return io_close(); } +static struct io_plan read_buf(struct io_conn *conn, void *unused) +{ + return io_read(inbuf, 8, io_close_cb, NULL); +} + int main(void) { int fds[2]; @@ -23,7 +28,7 @@ int main(void) plan_tests(3); ok1(pipe(fds) == 0); - conn = io_new_conn(fds[0], io_idle()); + conn = io_new_conn(fds[0], io_wait(inbuf, read_buf, NULL)); io_new_conn(fds[1], io_write("EASYTEST", 8, wake_it, conn)); ok1(io_loop() == NULL);