diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-04-12 18:20:05 +0000 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-04-12 18:20:16 +0000 |
| commit | 5ceedab2137ed65c542ca00e528fe07d121799ad (patch) | |
| tree | c5aa961838c81e2a1a356e753c22eec7bc588180 /src/wrapped | |
| parent | 1c4f3cbf195453b214d3551d012cd17a38b8aaf3 (diff) | |
| download | box64-5ceedab2137ed65c542ca00e528fe07d121799ad.tar.gz box64-5ceedab2137ed65c542ca00e528fe07d121799ad.zip | |
Improve loading/unloading of libs, and fixed a regression when dlopen a lib after some dlclose
Diffstat (limited to 'src/wrapped')
| -rwxr-xr-x | src/wrapped/wrappedlibdl.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/wrapped/wrappedlibdl.c b/src/wrapped/wrappedlibdl.c index 2089a12c..ab154a27 100755 --- a/src/wrapped/wrappedlibdl.c +++ b/src/wrapped/wrappedlibdl.c @@ -37,8 +37,6 @@ void FreeDLPrivate(dlprivate_t **lib) { box_free(*lib); } -static needed_libs_t dl_loaded = {0}; - // dead_cells consider the "2" value to be some king of issue? #define MIN_NLIB 3 @@ -146,9 +144,6 @@ void* my_dlopen(x64emu_t* emu, void *filename, int flag) snprintf(dl->last_error, 129, "Cannot dlopen(\"%s\"/%p, %X)\n", rfilename, filename, flag); return NULL; } - add1_neededlib(&dl_loaded); - dl_loaded.names[dl_loaded.size-1] = tmp.names[0]; - dl_loaded.libs[dl_loaded.size-1] = tmp.libs[0]; lib = GetLibInternal(rfilename); RunDeferredElfInit(emu); } else { @@ -339,9 +334,7 @@ int my_dlclose(x64emu_t* emu, void *handle) return -1; } dl->count[nlib] = dl->count[nlib]-1; - if(!DecRefCount(&dl->libs[nlib], emu)) { - dl->count[nlib] = 0; - } + DecRefCount(&dl->libs[nlib], emu); return 0; } int my_dladdr1(x64emu_t* emu, void *addr, void *i, void** extra_info, int flags) |