Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/wrapped/wrappedlibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2711,6 +2711,9 @@ EXPORT int32_t my_execlp(x64emu_t* emu, const char* path)
EXPORT int32_t my_posix_spawn(x64emu_t* emu, pid_t* pid, const char* fullpath,
const posix_spawn_file_actions_t *actions, const posix_spawnattr_t* attrp, char* const argv[], char* const envp[])
{
// Some distros call a statically linked x86 ldconfig in scriptlets; skip it.
const char* base = fullpath ? strrchr(fullpath, '/') : NULL;
base = base ? base + 1 : fullpath;
int self = isProcSelf(fullpath, "exe");
int x64 = FileIsX64ELF(fullpath);
int x86 = my_context->box86path?FileIsX86ELF(fullpath):0;
Expand All @@ -2721,6 +2724,12 @@ EXPORT int32_t my_posix_spawn(x64emu_t* emu, pid_t* pid, const char* fullpath,
if(envp == my_context->envv && environ) {
envp = environ;
}
if(base && !strcmp(base, "ldconfig")) {
const char* truepath = "/bin/true";
char* const trueargv[] = { (char*)truepath, NULL };
printf_log(LOG_INFO, "posix_spawn: skip ldconfig (%s)\n", fullpath);
return posix_spawn(pid, truepath, actions, attrp, trueargv, envp);
}
if (x64 || x86 || script || self) {
int n=1;
while(argv[n]) ++n;
Expand Down Expand Up @@ -2753,6 +2762,8 @@ EXPORT int32_t my_posix_spawnp(x64emu_t* emu, pid_t* pid, const char* path,
// need to use BOX64_PATH / PATH here...
char* fullpath = ResolveFileSoft(path, &my_context->box64_path);
// use fullpath...
const char* base = fullpath ? strrchr(fullpath, '/') : NULL;
base = base ? base + 1 : fullpath;
int self = isProcSelf(fullpath, "exe");
int x64 = FileIsX64ELF(fullpath);
int x86 = my_context->box86path?FileIsX86ELF(path):0;
Expand All @@ -2763,6 +2774,14 @@ EXPORT int32_t my_posix_spawnp(x64emu_t* emu, pid_t* pid, const char* path,
if(envp == my_context->envv && environ) {
envp = environ;
}
if(base && !strcmp(base, "ldconfig")) {
const char* truepath = "/bin/true";
char* const trueargv[] = { (char*)truepath, NULL };
printf_log(LOG_INFO, "posix_spawnp: skip ldconfig (%s)\n", fullpath);
ret = posix_spawn(pid, truepath, actions, attrp, trueargv, envp);
box_free(fullpath);
return ret;
}
if (x64 || x86 || script || self) {
int n=1;
while(argv[n]) ++n;
Expand Down
Loading