From: Jun-ichiro itojun Hagino Date: 1999-05-20T13:06:56+09:00 Subject: [ruby-dev:6919] ext/socket/getaddrinfo.c tiny fix ext/socket/getaddrinfo.cに以下のpatchをおねがいします。 IPv4 only kernelの上でgetaddrinfo(NULL, "ftp", &hints, &res) (hints.ai_flags = AI_PASSIVE)としたときにAF_INET6のアドレスが 返るのをふせぎます。 itojun ? Makefile Index: getaddrinfo.c =================================================================== RCS file: /home/cvs/ruby/ext/socket/Attic/getaddrinfo.c,v retrieving revision 1.1.2.5 diff -c -r1.1.2.5 getaddrinfo.c *** getaddrinfo.c 1999/05/10 08:22:49 1.1.2.5 --- getaddrinfo.c 1999/05/20 03:43:44 *************** *** 394,405 **** --- 394,415 ---- */ if (hostname == NULL) { struct afd *afd; + int s; for (afd = &afdl[0]; afd->a_af; afd++) { if (!(pai->ai_family == PF_UNSPEC || pai->ai_family == afd->a_af)) { continue; } + + /* + * filter out AFs that are not supported by the kernel + * XXX errno? + */ + s = socket(afd->a_af, SOCK_DGRAM, 0); + if (s < 0) + continue; + close(s); if (pai->ai_flags & AI_PASSIVE) { GET_AI(cur->ai_next, afd, afd->a_addrany, port);