summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-09-30 00:20:35 +0900
committerNobuyoshi Nakada <[email protected]>2024-09-30 00:20:35 +0900
commita0838a39021ccb0d38d69c2c3e6793290b979747 (patch)
tree72a803aea5c13ca106a89aceaf57a4adce74c7c2
parent5139a574aa00e034bfb1dbdc9d97aca207916817 (diff)
Raise fatal error instead of BUG
Failures due to the external setting is not a bug of ruby itself.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11726
-rw-r--r--gc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/gc.c b/gc.c
index 10ab04fb81..9e85906d65 100644
--- a/gc.c
+++ b/gc.c
@@ -674,31 +674,31 @@ ruby_external_gc_init(void)
case '.':
break;
default:
- rb_bug("Only alphanumeric, dash, underscore, and period is allowed in "RUBY_GC_LIBRARY"");
+ rb_fatal("Only alphanumeric, dash, underscore, and period is allowed in "RUBY_GC_LIBRARY"");
}
}
gc_so_path = alloca(strlen(SHARED_GC_DIR) + strlen(gc_so_file) + 1);
strcpy(gc_so_path, SHARED_GC_DIR);
strcpy(gc_so_path + strlen(SHARED_GC_DIR), gc_so_file);
- gc_so_path[strlen(SHARED_GC_DIR) + strlen(gc_so_file)] = '\0';
handle = dlopen(gc_so_path, RTLD_LAZY | RTLD_GLOBAL);
if (!handle) {
- fprintf(stderr, "%s\n", dlerror());
- rb_bug("ruby_external_gc_init: Shared library %s cannot be opened", gc_so_path);
+ rb_fatal("ruby_external_gc_init: Shared library %s cannot be opened: %s", gc_so_path, dlerror());
}
}
+ rb_gc_function_map_t gc_functions;
+
# define load_external_gc_func(name) do { \
if (handle) { \
- rb_gc_functions.name = dlsym(handle, "rb_gc_impl_" #name); \
- if (!rb_gc_functions.name) { \
- rb_bug("ruby_external_gc_init: " #name " func not exported by library %s", gc_so_path); \
+ 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); \
} \
} \
else { \
- rb_gc_functions.name = rb_gc_impl_##name; \
+ gc_functions.name = rb_gc_impl_##name; \
} \
} while (0)
@@ -777,6 +777,8 @@ ruby_external_gc_init(void)
load_external_gc_func(copy_attributes);
# undef load_external_gc_func
+
+ rb_gc_functions = gc_functions;
}
// Bootup