diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-11-14 10:44:47 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-11-14 10:44:55 +0100 |
| commit | a1573835dd4d0845ad534bda75008901187ae93a (patch) | |
| tree | 6165b65f3d355bf11041569c2e8ec1dbb2c4a515 /src | |
| parent | 34355d6b0c537ccdfcfcdb30e8c3e6672a8ee72b (diff) | |
| download | box64-a1573835dd4d0845ad534bda75008901187ae93a.tar.gz box64-a1573835dd4d0845ad534bda75008901187ae93a.zip | |
Change ResolvePath behaviour in sync with box86
Diffstat (limited to 'src')
| -rwxr-xr-x | src/main.c | 10 | ||||
| -rwxr-xr-x | src/tools/fileutils.c | 2 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibc.c | 4 |
3 files changed, 3 insertions, 13 deletions
diff --git a/src/main.c b/src/main.c index 682f4fe6..933cd57f 100755 --- a/src/main.c +++ b/src/main.c @@ -848,10 +848,7 @@ int main(int argc, const char **argv, const char **env) { // check BOX64_LD_LIBRARY_PATH and load it LoadEnvVars(my_context); - if(argv[0][0]=='/') - my_context->box64path = strdup(argv[0]); - else - my_context->box64path = ResolveFile(argv[0], &my_context->box64_path); + my_context->box64path = ResolveFile(argv[0], &my_context->box64_path); // prepare all other env. var my_context->envc = CountEnv(environ?environ:env); printf_log(LOG_INFO, "Counted %d Env var\n", my_context->envc); @@ -893,10 +890,7 @@ int main(int argc, const char **argv, const char **env) { } // lets build argc/argv stuff printf_log(LOG_INFO, "Looking for %s\n", prog); - if(strchr(prog, '/')) - my_context->argv[0] = strdup(prog); - else - my_context->argv[0] = ResolveFile(prog, &my_context->box64_path); + my_context->argv[0] = ResolveFile(prog, &my_context->box64_path); // check if box86 is present { my_context->box86path = strdup(my_context->box64path); diff --git a/src/tools/fileutils.c b/src/tools/fileutils.c index fe927398..5a6c0af8 100755 --- a/src/tools/fileutils.c +++ b/src/tools/fileutils.c @@ -60,7 +60,7 @@ char* ResolveFile(const char* filename, path_collection_t* paths) return realpath(p, NULL); } - return NULL; + return strdup(filename); //NULL; } int FileIsX64ELF(const char* filename) diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index 1d9ee570..91bc50b4 100755 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -1653,8 +1653,6 @@ EXPORT int32_t my_execvp(x64emu_t* emu, const char* path, char* const argv[]) { // need to use BOX64_PATH / PATH here... char* fullpath = ResolveFile(path, &my_context->box64_path); - if(!fullpath) - fullpath = strdup(path); // use fullpath... int self = isProcSelf(fullpath, "exe"); int x64 = FileIsX64ELF(fullpath); @@ -1705,8 +1703,6 @@ EXPORT int32_t my_execlp(x64emu_t* emu, const char* path) { // need to use BOX64_PATH / PATH here... char* fullpath = ResolveFile(path, &my_context->box64_path); - if(!fullpath) - fullpath = strdup(path); // use fullpath... int self = isProcSelf(fullpath, "exe"); int x64 = FileIsX64ELF(fullpath); |