Ruby exception cannot work here

Just show error messages then ignore the invalid library.
This commit is contained in:
Nobuyoshi Nakada 2024-09-30 09:40:34 +09:00 коммит произвёл Nobuyoshi Nakada
Родитель 03ca99c93b
Коммит 28a01e306a
1 изменённых файлов: 5 добавлений и 3 удалений

8
gc.c
Просмотреть файл

@ -652,6 +652,8 @@ static rb_gc_function_map_t rb_gc_functions;
# define RUBY_GC_LIBRARY "RUBY_GC_LIBRARY"
# define fatal(...) do {fprintf(stderr, "" __VA_ARGS__); return;} while (0)
static void
ruby_external_gc_init(void)
{
@ -674,7 +676,7 @@ ruby_external_gc_init(void)
case '.':
break;
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);
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) { \
gc_functions.name = dlsym(handle, "rb_gc_impl_" #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 { \