summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-27 02:09:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-27 02:09:34 +0000
commit8df4564367f895a5ba6f9186f7c90ebd07c874bb (patch)
tree1ef0d6594f3e627ff26b5e272fa81cedc6970a6b /ext/socket
parent2a49751d8e14614229c28f5991898d37367b68a4 (diff)
* ext/socket/socket.c (s_recvfrom): sending length should be an
invariant while retrying on EAGAIN. [ruby-talk:89962] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/socket.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 0e2ddb6120..53b87216b0 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -416,6 +416,7 @@ s_recvfrom(sock, argc, argv, from)
char buf[1024];
socklen_t alen = sizeof buf;
VALUE len, flg;
+ long buflen;
long slen;
int fd, flags;
@@ -430,13 +431,13 @@ s_recvfrom(sock, argc, argv, from)
}
fd = fileno(fptr->f);
- slen = NUM2INT(len);
- str = rb_tainted_str_new(0, slen);
+ buflen = NUM2INT(len);
+ str = rb_tainted_str_new(0, buflen);
retry:
rb_thread_wait_fd(fd);
TRAP_BEG;
- slen = recvfrom(fd, RSTRING(str)->ptr, slen, flags, (struct sockaddr*)buf, &alen);
+ slen = recvfrom(fd, RSTRING(str)->ptr, buflen, flags, (struct sockaddr*)buf, &alen);
TRAP_END;
if (slen < 0) {