diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-19 19:17:33 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-19 19:17:33 +0000 |
commit | 9f6b3edcd65e2f62f38106495f03f986f6dc9673 (patch) | |
tree | 38e816c1ccabb276324a5ae54ec8b58941bbf6fb /ext/socket/socket.c | |
parent | b9ec9b69a92432c5566f7a7981945dfe1c2c6d18 (diff) | |
download | ruby-9f6b3edcd65e2f62f38106495f03f986f6dc9673.tar.gz |
* array.c (rb_ary_times): Array#* should return an instance of
the class of right operand. [ruby-dev:24526]
* ext/zlib/zlib.c (zstream_detach_buffer): should not expose
class-less object to Ruby world. [ruby-dev:24530]
* eval.c (proc_dup): provide Proc#dup as well. [ruby-talk:116915]
* eval.c (ruby_exec): stack marking position may be higher than
expected. thanks to Guy Decoux. [ruby-core:03527]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 044d411b29..5c57f2e1f1 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -285,6 +285,8 @@ bsock_setsockopt(sock, lev, optname, val) rb_secure(2); level = NUM2INT(lev); option = NUM2INT(optname); + GetOpenFile(sock, fptr); + switch (TYPE(val)) { case T_FIXNUM: i = FIX2INT(val); @@ -304,7 +306,6 @@ bsock_setsockopt(sock, lev, optname, val) break; } - GetOpenFile(sock, fptr); if (setsockopt(fileno(fptr->f), level, option, v, vlen) < 0) rb_sys_fail(fptr->path); @@ -2182,7 +2183,7 @@ sock_s_gethostbyaddr(argc, argv) t = AF_INET6; } #endif - h = gethostbyaddr((char*)RSTRING(addr)->ptr, RSTRING(addr)->len, t); + h = gethostbyaddr(RSTRING(addr)->ptr, RSTRING(addr)->len, t); if (h == NULL) { #ifdef HAVE_HSTRERROR extern int h_errno; @@ -2223,14 +2224,15 @@ sock_s_getservbyaname(argc, argv) rb_scan_args(argc, argv, "11", &service, &proto); if (NIL_P(proto)) proto = rb_str_new2("tcp"); - else StringValue(proto); + StringValue(service); + StringValue(proto); - sp = getservbyname((char*)RSTRING(service)->ptr, RSTRING(proto)->ptr); + sp = getservbyname(StringValueCStr(service), StringValueCStr(proto)); if (sp) { port = ntohs(sp->s_port); } else { - char *s = StringValuePtr(service); + char *s = RSTRING(service)->ptr; char *end; port = strtoul(s, &end, 0); |