You've already forked macports-ports
mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
8e417bee35
- refactoring patch-bug15528.diff [ruby-core:29427] - delete unneeded two patchfiles (merged this version) git-svn-id: https://svn.macports.org/repository/macports/trunk/dports@69126 d073be05-634f-4543-b044-5fe20cf6d1d6
56 lines
2.2 KiB
Diff
56 lines
2.2 KiB
Diff
diff -ur ../ruby-1.8.7-p249.org/ext/socket/socket.c ./ext/socket/socket.c
|
|
--- ../ruby-1.8.7-p249.org/ext/socket/socket.c 2009-01-27 15:18:04.000000000 +0900
|
|
+++ ./ext/socket/socket.c 2010-06-22 21:54:15.000000000 +0900
|
|
@@ -234,6 +234,33 @@
|
|
#endif
|
|
#endif
|
|
|
|
+static int str_isnumber __P((const char *));
|
|
+
|
|
+#if defined(__APPLE__)
|
|
+/* fix [ruby-core:29427] */
|
|
+static int
|
|
+ruby_getaddrinfo__darwin(const char *nodename, const char *servname,
|
|
+ struct addrinfo *hints, struct addrinfo **res)
|
|
+{
|
|
+ const char *tmp_servname;
|
|
+ struct addrinfo tmp_hints;
|
|
+ tmp_servname = servname;
|
|
+ MEMCPY(&tmp_hints, hints, struct addrinfo, 1);
|
|
+ if (nodename && servname) {
|
|
+ if (str_isnumber(tmp_servname) && atoi(servname) == 0) {
|
|
+ tmp_servname = NULL;
|
|
+#ifdef AI_NUMERICSERV
|
|
+ if (tmp_hints.ai_flags) tmp_hints.ai_flags &= ~AI_NUMERICSERV;
|
|
+#endif
|
|
+ }
|
|
+ }
|
|
+ int error = getaddrinfo(nodename, tmp_servname, &tmp_hints, res);
|
|
+ return error;
|
|
+}
|
|
+#undef getaddrinfo
|
|
+#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo__darwin((node),(serv),(hints),(res))
|
|
+#endif
|
|
+
|
|
#ifdef HAVE_CLOSESOCKET
|
|
#undef close
|
|
#define close closesocket
|
|
diff -ur ../ruby-1.8.7-p249.org/test/socket/test_socket.rb ./test/socket/test_socket.rb
|
|
--- ../ruby-1.8.7-p249.org/test/socket/test_socket.rb 2007-02-13 08:01:19.000000000 +0900
|
|
+++ ./test/socket/test_socket.rb 2010-06-22 21:55:29.000000000 +0900
|
|
@@ -71,6 +71,14 @@
|
|
}
|
|
end
|
|
end
|
|
+
|
|
+ def test_getaddrinfo_raises_no_errors_on_port_argument_of_0 # [ruby-core:29427]
|
|
+ assert_nothing_raised('[ruby-core:29427]'){ Socket.getaddrinfo('localhost', 0, Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) }
|
|
+ assert_nothing_raised('[ruby-core:29427]'){ Socket.getaddrinfo('localhost', '0', Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) }
|
|
+ assert_nothing_raised('[ruby-core:29427]'){ Socket.getaddrinfo('localhost', '00', Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) }
|
|
+ assert_raise(SocketError, '[ruby-core:29427]'){ Socket.getaddrinfo(nil, nil, Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) }
|
|
+ assert_nothing_raised('[ruby-core:29427]'){ TCPServer.open('localhost', 0) {} }
|
|
+ end
|
|
end if defined?(Socket)
|
|
|
|
class TestSocket < Test::Unit::TestCase
|