about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-06-19 15:28:13 +0200
committerptitSeb <sebastien.chev@gmail.com>2022-06-19 15:28:13 +0200
commit7adaf39f1a7e1df0641f6425622899d363bf8cb5 (patch)
treef4080d9eb175960430d788193f940d99beeeee4c
parent6392550208eadf07419692920acc2955bb844af7 (diff)
downloadbox64-7adaf39f1a7e1df0641f6425622899d363bf8cb5.tar.gz
box64-7adaf39f1a7e1df0641f6425622899d363bf8cb5.zip
Better handling of LD_PRELOAD libraries
-rwxr-xr-xsrc/main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 9a75ee07..0e80523b 100755
--- a/src/main.c
+++ b/src/main.c
@@ -1334,9 +1334,10 @@ int main(int argc, const char **argv, char **env) {
     AddMainElfToLinkmap(elf_header);
     // pre-load lib if needed
     if(ld_preload.size) {
-        if(AddNeededLib(NULL, NULL, NULL, 0, 0, (const char**)ld_preload.paths, ld_preload.size, my_context, emu)) {
-            printf_log(LOG_INFO, "Warning, cannot pre-load a lib\n");
-        }
+        for(int i=0; i<ld_preload.size; ++i)
+            if(AddNeededLib(my_context->maplib, &my_context->neededlibs, NULL, 0, 0, (const char**)&ld_preload.paths[i], 1, my_context, emu)) {
+                printf_log(LOG_INFO, "Warning, cannot pre-load a lib (%s)\n", ld_preload.paths[i]);
+            }            
     }
     FreeCollection(&ld_preload);
     // Call librarian to load all dependant elf