1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add test for r32586.

FreeBSD (at least 7.2 to 7.2) calls nsdispatch(3) when it calls
getaddrinfo(3). And nsdispatch(3) doesn't call dlerror(3) even if
it calls _nss_cache_cycle_prevention_function with dlsym(3).
So our DL::Handle#sym must call dlerror(3) before call dlsym.
In general uses of dlerror(3) should call it before use it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2011-07-20 15:20:14 +00:00
parent 4c58bed876
commit 4aa9e1ace0

View file

@ -169,5 +169,16 @@ module DL
handle = DL::Handle::DEFAULT
assert_not_nil handle['malloc']
end unless /mswin|mingw/ =~ RUBY_PLATFORM
def test_dlerror
# FreeBSD (at least 7.2 to 7.2) calls nsdispatch(3) when it calls
# getaddrinfo(3). And nsdispatch(3) doesn't call dlerror(3) even if
# it calls _nss_cache_cycle_prevention_function with dlsym(3).
# So our DL::Handle#sym must call dlerror(3) before call dlsym.
# In general uses of dlerror(3) should call it before use it.
require 'socket'
Socket.gethostbyname("localhost")
DL.dlopen("/usr/lib/libc.so").sym('strcpy')
end if /freebsd/=~ RUBY_PLATFORM
end
end