summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-22 12:49:11 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-22 12:49:11 +0000
commite0a17f3b054667054724f621a101d1cd4cc7fbd4 (patch)
treec37dd17bc4e04f2494141e36aeb5a9ab26f45a24 /test
parent2b7e8f86e18f7d81a1b6962809e0be032ac39006 (diff)
merge revision(s) 32590:
------------------------------------------------------------------------ r32590 | naruse | 2011-07-21 00:20:14 +0900 (Thu, 21 Jul 2011) | 7 lines 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/branches/ruby_1_9_3@32624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/dl/test_handle.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/dl/test_handle.rb b/test/dl/test_handle.rb
index 3f423925d9..cc4df49c84 100644
--- a/test/dl/test_handle.rb
+++ b/test/dl/test_handle.rb
@@ -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