You've already forked macports-ports
mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
b03020fdb2
add two patches to solve error of drb. git-svn-id: https://svn.macports.org/repository/macports/trunk/dports@63130 d073be05-634f-4543-b044-5fe20cf6d1d6
70 lines
2.4 KiB
Diff
70 lines
2.4 KiB
Diff
diff -ur ../ruby-1.8.6-p388.org/ext/socket/socket.c ./ext/socket/socket.c
|
|
--- ../ruby-1.8.6-p388.org/ext/socket/socket.c 2009-01-27 15:17:02.000000000 +0900
|
|
+++ ./ext/socket/socket.c 2010-01-27 22:19:05.000000000 +0900
|
|
@@ -877,6 +877,14 @@
|
|
}
|
|
else if (FIXNUM_P(port)) {
|
|
snprintf(pbuf, len, "%ld", FIX2LONG(port));
|
|
+ /* It looks like getaddrinfo changed in Mac OS X 10.5.3 so that sending "0"
|
|
+ * as the argument for the port number makes it return EAI_NONAME
|
|
+ * but feeding it a port number of NULL seems to do the trick.
|
|
+ * RSD - 2008-06-05
|
|
+ */
|
|
+ if (FIX2LONG(port) == 0) {
|
|
+ return "";
|
|
+ }
|
|
return pbuf;
|
|
}
|
|
else {
|
|
@@ -3591,6 +3599,14 @@
|
|
else if (FIXNUM_P(port)) {
|
|
snprintf(pbuf, sizeof(pbuf), "%ld", FIX2LONG(port));
|
|
pptr = pbuf;
|
|
+ /* It looks like getaddrinfo changed in Mac OS X 10.5.3 so that sending "0"
|
|
+ * as the argument for the port number makes it return EAI_NONAME
|
|
+ * but feeding it a port number of NULL seems to do the trick.
|
|
+ * RSD - 2008-06-05
|
|
+ */
|
|
+ if (FIX2LONG(port) == 0) {
|
|
+ pptr = NULL;
|
|
+ }
|
|
}
|
|
else {
|
|
strncpy(pbuf, StringValuePtr(port), sizeof(pbuf));
|
|
@@ -3716,7 +3732,15 @@
|
|
}
|
|
else if (FIXNUM_P(port)) {
|
|
snprintf(pbuf, sizeof(pbuf), "%ld", NUM2LONG(port));
|
|
- pptr = pbuf;
|
|
+ pptr = pbuf;
|
|
+ /* It looks like getaddrinfo changed in Mac OS X 10.5.3 so that sending "0"
|
|
+ * as the argument for the port number makes it return EAI_NONAME
|
|
+ * but feeding it a port number of NULL seems to do the trick.
|
|
+ * RSD - 2008-06-05
|
|
+ */
|
|
+ if (NUM2LONG(port) == 0) {
|
|
+ pptr = NULL;
|
|
+ }
|
|
}
|
|
else {
|
|
strncpy(pbuf, StringValuePtr(port), sizeof(pbuf));
|
|
Only in ./ext/socket: socket.c.orig
|
|
diff -ur ../ruby-1.8.6-p388.org/test/socket/test_socket.rb ./test/socket/test_socket.rb
|
|
--- ../ruby-1.8.6-p388.org/test/socket/test_socket.rb 2007-02-13 08:01:19.000000000 +0900
|
|
+++ ./test/socket/test_socket.rb 2010-01-27 22:19:05.000000000 +0900
|
|
@@ -57,6 +57,14 @@
|
|
}
|
|
end
|
|
end
|
|
+
|
|
+ def test_getaddrinfo_raises_no_errors_on_port_argument_of_0
|
|
+ # Added 2008-06-05 to ensure that Mac OS X 10.5.3's changes to getaddrinfo don't cause
|
|
+ # Ruby's Socket-based classes to fail.
|
|
+ # Here are two of the situations I found that were causing erroneous errors
|
|
+ assert_nothing_raised(){Socket.getaddrinfo(Socket.gethostname, 0, Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)}
|
|
+ assert_nothing_raised(){TCPServer.open('localhost', 0)}
|
|
+ end
|
|
|
|
def test_listen
|
|
s = nil
|