Skip to content

Commit da05e24

Browse files
committed
Fix logic in Socket.gethostbyname to only use config values
* And not the internals of the FFI::Struct representation.
1 parent c5b85bf commit da05e24

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/truffle/socket/socket.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ def self.gethostbyname(hostname)
140140

141141

142142
if a[4] == AF_INET
143-
offset, type = Truffle::Socket::Foreign::SockaddrIn.layout[:sin_addr]
144-
size = FFI.type_size(type) # TODO BJF 30-Apr-2017 This appears to be a bug in rubysl-socket?
143+
offset = Truffle::Config['platform.sockaddr_in.sin_addr.offset']
144+
size = Truffle::Config['platform.sockaddr_in.sin_addr.size']
145145
addresses << sockaddr.byteslice(offset, size)
146146
elsif a[4] == AF_INET6
147-
offset, type = Truffle::Socket::Foreign::SockaddrIn6.layout[:sin6_addr]
148-
size = FFI.type_size(type) # TODO BJF 30-Apr-2017 This appears to be a bug in rubysl-socket?
147+
offset = Truffle::Config['platform.sockaddr_in6.sin6_addr.offset']
148+
size = Truffle::Config['platform.sockaddr_in6.sin6_addr.size']
149149
addresses << sockaddr.byteslice(offset, size)
150150
end
151151
end

0 commit comments

Comments
 (0)