summaryrefslogtreecommitdiff
diff options
authorPeter Zhu <[email protected]>2024-04-25 10:45:26 -0400
committerPeter Zhu <[email protected]>2024-04-26 11:43:14 -0400
commit353cba49558d56b10ed549a628ee54cd8875b8f5 (patch)
treefaaa6f009a783852e9739697c475b112f8c5ea98
parent67b79d484f97033d362305607f0031ef7fa39f12 (diff)
Use fprintf for error message when loading external GC
The error message is often long, so using a small buffer could cause it to be truncated. rb_bug also has a 256 byte message buffer, so it could also be truncated.
-rw-r--r--gc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gc.c b/gc.c
index 5784ce4994..564b765e60 100644
--- a/gc.c
+++ b/gc.c
@@ -1893,10 +1893,11 @@ ruby_external_gc_init()
char *gc_so_path = getenv("RUBY_GC_LIBRARY_PATH");
void *handle = NULL;
if (gc_so_path) {
- char error[128];
+ char error[1024];
handle = dln_open(gc_so_path, error, sizeof(error));
if (!handle) {
- rb_bug("ruby_external_gc_init: Shared library %s cannot be opened (%s)", gc_so_path, error);
+ fprintf(stderr, "%s", error);
+ rb_bug("ruby_external_gc_init: Shared library %s cannot be opened", gc_so_path);
}
}