Bug #2142 ยป dl.patch
| ext/dl/dl.c | ||
|---|---|---|
|
VALUE
|
||
|
rb_dl_dlopen(int argc, VALUE argv[], VALUE self)
|
||
|
{
|
||
|
rb_secure(2);
|
||
|
return rb_class_new_instance(argc, argv, rb_cDLHandle);
|
||
|
}
|
||
| ext/dl/handle.c | ||
|---|---|---|
|
rb_bug("rb_dlhandle_new");
|
||
|
}
|
||
|
rb_secure(2);
|
||
|
#if defined(HAVE_WINDOWS_H)
|
||
|
if( !clib ){
|
||
|
HANDLE rb_libruby_handle(void);
|
||
| test/dl/test_handle.rb | ||
|---|---|---|
|
require 'test_base'
|
||
|
module DL
|
||
|
class TestHandle < TestBase
|
||
|
def test_dlopen_returns_handle
|
||
|
assert_instance_of DL::Handle, dlopen(LIBC_SO)
|
||
|
end
|
||
|
def test_dlopen_safe
|
||
|
assert_raises(SecurityError) do
|
||
|
Thread.new do
|
||
|
$SAFE = 2
|
||
|
dlopen(LIBC_SO)
|
||
|
end.join
|
||
|
end
|
||
|
end
|
||
|
def test_initialize_safe
|
||
|
assert_raises(SecurityError) do
|
||
|
Thread.new do
|
||
|
$SAFE = 2
|
||
|
DL::Handle.new(LIBC_SO)
|
||
|
end.join
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||