summaryrefslogtreecommitdiff
path: root/ext/socket/socket.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-01-17 08:37:53 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-01-17 08:37:53 +0000
commitdde62bcd2efbb3825d982326896ab774e73e4218 (patch)
tree6a421d3818dd390cf8f6b2c5544726a8950e1401 /ext/socket/socket.c
parente43877719bd4bbd12e493e896a0f98c5b349937b (diff)
2000-01-17
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r--ext/socket/socket.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 3605e99..3709402 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -373,10 +373,14 @@ s_recv(sock, argc, argv, from)
if (flg == Qnil) flags = 0;
else flags = NUM2INT(flg);
- str = rb_str_new(0, NUM2INT(len));
-
GetOpenFile(sock, fptr);
+ if (rb_read_pending(fptr->f)) {
+ rb_raise(rb_eIOError, "recv for buffered IO");
+ }
fd = fileno(fptr->f);
+
+ str = rb_str_new(0, NUM2INT(len));
+
rb_thread_wait_fd(fd);
TRAP_BEG;
retry: