Ruby exception cannot work here
Just show error messages then ignore the invalid library.
This commit is contained in:
parent
03ca99c93b
commit
28a01e306a
8
gc.c
8
gc.c
@ -652,6 +652,8 @@ static rb_gc_function_map_t rb_gc_functions;
|
|||||||
|
|
||||||
# define RUBY_GC_LIBRARY "RUBY_GC_LIBRARY"
|
# define RUBY_GC_LIBRARY "RUBY_GC_LIBRARY"
|
||||||
|
|
||||||
|
# define fatal(...) do {fprintf(stderr, "" __VA_ARGS__); return;} while (0)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ruby_external_gc_init(void)
|
ruby_external_gc_init(void)
|
||||||
{
|
{
|
||||||
@ -674,7 +676,7 @@ ruby_external_gc_init(void)
|
|||||||
case '.':
|
case '.':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rb_fatal("Only alphanumeric, dash, underscore, and period is allowed in "RUBY_GC_LIBRARY"");
|
fatal("Only alphanumeric, dash, underscore, and period is allowed in "RUBY_GC_LIBRARY"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,7 +686,7 @@ ruby_external_gc_init(void)
|
|||||||
|
|
||||||
handle = dlopen(gc_so_path, RTLD_LAZY | RTLD_GLOBAL);
|
handle = dlopen(gc_so_path, RTLD_LAZY | RTLD_GLOBAL);
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
rb_fatal("ruby_external_gc_init: Shared library %s cannot be opened: %s", gc_so_path, dlerror());
|
fatal("ruby_external_gc_init: Shared library %s cannot be opened: %s", gc_so_path, dlerror());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -694,7 +696,7 @@ ruby_external_gc_init(void)
|
|||||||
if (handle) { \
|
if (handle) { \
|
||||||
gc_functions.name = dlsym(handle, "rb_gc_impl_" #name); \
|
gc_functions.name = dlsym(handle, "rb_gc_impl_" #name); \
|
||||||
if (!gc_functions.name) { \
|
if (!gc_functions.name) { \
|
||||||
rb_fatal("ruby_external_gc_init: " #name " func not exported by library %s", gc_so_path); \
|
fatal("ruby_external_gc_init: " #name " func not exported by library %s", gc_so_path); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
else { \
|
else { \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user