From 9cfe35ad503cd6bb598dea85517949b932719afe Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 21 Feb 2009 15:57:52 +0000 Subject: * io.c (io_getpartial): error message describes what should be waited after nonblocking error. (rb_io_write_nonblock): ditto. * ext/socket/init.c (s_recvfrom_nonblock): ditto. (s_accept_nonblock): ditto. * ext/socket/socket.c (sock_connect_nonblock): ditto. * ext/socket/ancdata.c (bsock_sendmsg_internal): ditto. (bsock_recvmsg_internal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'io.c') diff --git a/io.c b/io.c index 2ed05b3d56..59bf9662a7 100644 --- a/io.c +++ b/io.c @@ -1754,6 +1754,8 @@ io_getpartial(int argc, VALUE *argv, VALUE io, int nonblock) if (n < 0) { if (!nonblock && rb_io_wait_readable(fptr->fd)) goto again; + if (nonblock && errno == EWOULDBLOCK) + rb_sys_fail("WANT_READ"); rb_sys_fail_path(fptr->pathv); } else if (n == 0) { @@ -1952,7 +1954,11 @@ rb_io_write_nonblock(VALUE io, VALUE str) rb_io_set_nonblock(fptr); n = write(fptr->fd, RSTRING_PTR(str), RSTRING_LEN(str)); - if (n == -1) rb_sys_fail_path(fptr->pathv); + if (n == -1) { + if (errno == EWOULDBLOCK) + rb_sys_fail("WANT_WRITE"); + rb_sys_fail_path(fptr->pathv); + } return LONG2FIX(n); } -- cgit v1.2.3