diff options
author | drew-wells <58978640+drew-wells@users.noreply.github.com> | 2023-03-21 10:10:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-21 19:10:19 +0900 |
commit | 9aaf2b752685f9e11b28fbe647289f12d75d9f5e (patch) | |
tree | 68aecec6147d5f19698bd16ccaa151034df13951 /dln.c | |
parent | 6eac424e5ef0a48e078986c764072aa243965dcc (diff) |
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)`.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7552
Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'dln.c')
-rw-r--r-- | dln.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -392,6 +392,12 @@ dln_open(const char *file) dln_fatalerror("%s - %s", incompatible, file); } else { + if (libruby_name) { + const size_t len = strlen(libruby_name); + char *const tmp = ALLOCA_N(char, len + 1); + if (tmp) memcpy(tmp, libruby_name, len + 1); + libruby_name = tmp; + } dlclose(handle); if (libruby_name) { dln_loaderror("linked to incompatible %s - %s", libruby_name, file); |