summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-21 15:57:52 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-21 15:57:52 +0000
commit9cfe35ad503cd6bb598dea85517949b932719afe (patch)
tree00b50c4b264d237624d19632bc9b086feaeac4a8 /io.c
parent6adda0379c0dc2b2f881060cba2ad40493e59608 (diff)
* 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
Diffstat (limited to 'io.c')
-rw-r--r--io.c8
1 files changed, 7 insertions, 1 deletions
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);
}