Skip to content

Commit 9aaf2b7

Browse files
authored
Update dln.c to fix error output from dln_open()
`libruby_name` gets trashed by `dlclose(handle)`, so output the "linked to incompatible ... " error before calling `dlclose(handle)`.
1 parent 6eac424 commit 9aaf2b7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

dln.c

+6
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,12 @@ dln_open(const char *file)
392392
dln_fatalerror("%s - %s", incompatible, file);
393393
}
394394
else {
395+
if (libruby_name) {
396+
const size_t len = strlen(libruby_name);
397+
char *const tmp = ALLOCA_N(char, len + 1);
398+
if (tmp) memcpy(tmp, libruby_name, len + 1);
399+
libruby_name = tmp;
400+
}
395401
dlclose(handle);
396402
if (libruby_name) {
397403
dln_loaderror("linked to incompatible %s - %s", libruby_name, file);

0 commit comments

Comments
 (0)