[#2968] dbm/gdbm/sdbm etc — Dave Thomas <dave@...>
Does ext/dbm supersede gdbm and sdbm?
7 messages
2004/06/07
[#2977] Enumerable#each_with_index in "ri" — Johan Holmberg <holmberg@...>
11 messages
2004/06/12
[#3132] Reporting RI-documentation corrections ?
— Johan Holmberg <holmberg@...>
2004/07/05
[#3133] Re: Reporting RI-documentation corrections ?
— Dave Thomas <dave@...>
2004/07/05
[#3135] Re: Reporting RI-documentation corrections ?
— Austin Ziegler <halostatue@...>
2004/07/05
Speaking of ri documentation, is there anywhere that documents the
[#2978] Date.from_time — Gavin Sinclair <gsinclair@...>
Folks,
5 messages
2004/06/13
[#2982] Array#shift(n) — Michal Rokos <michal@...>
Hello,
15 messages
2004/06/14
[#2985] Re: [Patch] Array#shift(n)
— nobu.nokada@...
2004/06/14
Hi,
[#2987] Re: [Patch] Array#shift(n)
— matz@... (Yukihiro Matsumoto)
2004/06/14
Hi,
[#2988] Re: [Patch] Array#shift(n)
— Michal Rokos <michal@...>
2004/06/14
On Monday 14 of June 2004 16:13, Yukihiro Matsumoto wrote:
[#2989] Re: [Patch] Array#shift(n)
— matz@... (Yukihiro Matsumoto)
2004/06/14
Hi,
[#2991] Re: [Patch] Array#shift(n)
— Michal Rokos <michal@...>
2004/06/14
Hello,
[#2998] Re: [Patch] Array#shift(n)
— nobu.nokada@...
2004/06/15
Hi,
[#2999] Re: [Patch] Array#shift(n)
— Michal Rokos <michal@...>
2004/06/15
Hello,
[#3006] CVS repository — "Eugene Scripnik" <hoaz@...>
Hello.
21 messages
2004/06/16
[#3008] Re: CVS repository
— ts <decoux@...>
2004/06/16
>>>>> "E" == Eugene Scripnik <hoaz@gala.net> writes:
[#3009] Re: CVS repository
— Michal Rokos <michal@...>
2004/06/16
Hi!
[#3010] Re: CVS repository
— Elliott Hughes <ehughes@...>
2004/06/16
On Wed, 2004-06-16 at 09:45, Michal Rokos wrote:
[#3011] Re: CVS repository
— ts <decoux@...>
2004/06/16
>>>>> "M" == Michal Rokos <michal@ruby-lang.org> writes:
[#3012] Re: CVS repository
— "Eugene Scripnik" <hoaz@...>
2004/06/16
Hello.
[#3027] rb_mod_freeze??? — Michal Rokos <michal@...>
Hello!
5 messages
2004/06/17
[#3047] Move all stack info to gc.c — Michal Rokos <michal@...>
Hello,
13 messages
2004/06/23
[#3049] Re: [Patch] Move all stack info to gc.c
— matz@... (Yukihiro Matsumoto)
2004/06/23
Hi,
[#3057] Ruby 1.8.2 to be released. — matz@... (Yukihiro Matsumoto)
Hi,
20 messages
2004/06/23
[#3060] Re: Ruby 1.8.2 to be released.
— Hugh Sasse Staff Elec Eng <hgs@...>
2004/06/23
On Thu, 24 Jun 2004, Yukihiro Matsumoto wrote:
[#3063] Re: Ruby 1.8.2 to be released.
— matz@... (Yukihiro Matsumoto)
2004/06/23
Hi,
[#3090] class= and type checks when casting — "Sean O'Dell" <sean@...>
Matz, I'm not sure if you followed the discussion in ruby-talk about having a
6 messages
2004/06/25
[#3095] 1.8.2: Segfault — Elven <elven@...>
6 messages
2004/06/26
[#3102] gdbm abort - OSX — Dave Thomas <dave@...>
Just before I start another debugging session, has anyone seen this, or
7 messages
2004/06/27
Re: More networking issues
From:
matz@... (Yukihiro Matsumoto)
Date:
2004-06-23 16:06:37 UTC
List:
ruby-core #3056
Hi,
In message "More networking issues"
on 04/06/23, Dave Thomas <dave@pragprog.com> writes:
|In 1.6, gethostbyname returned (for IPv4) the 4 byte address of the
|given host. In Ruby 1.9, it returns a 16 byte structure, which I'm
|assuming is a sockaddr_in.
|
|First, is that correct--was there a change between 1.6 and 1.8/9 on the
|return type of gethostbyname?
You're right. 1.8 (and 1.9) return packed struct sockaddr, but it
should return packed address information. Can you try the attached
fix?
matz.
Index: ext/socket/socket.c
===================================================================
RCS file: /var/cvs/src/ruby/ext/socket/socket.c,v
retrieving revision 1.125
diff -p -u -1 -r1.125 socket.c
--- ext/socket/socket.c 23 Jun 2004 13:22:28 -0000 1.125
+++ ext/socket/socket.c 23 Jun 2004 16:05:34 -0000
@@ -2097,3 +2097,20 @@ sock_sockaddr(addr, len)
{
- return rb_str_new((char*)addr, len);
+ char *ptr;
+
+ switch (addr->sa_family) {
+ case AF_INET:
+ ptr = (char*)&((struct sockaddr_in*)addr)->sin_addr.s_addr;
+ len = sizeof(((struct sockaddr_in*)addr)->sin_addr.s_addr);
+ break;
+#ifdef INET6
+ case AF_INET6:
+ ptr = (char*)&((struct sockaddr_in6*)addr)->sin6_addr.s6_addr;
+ len = sizeof(((struct sockaddr_in6*)addr)->sin6_addr.s6_addr);
+ break;
+#endif
+ default:
+ rb_raise(rb_eSocket, "unknown socket family:%d", addr->sa_family);
+ break;
+ }
+ return rb_str_new(ptr, len);
}