Module: wine Branch: master Commit: a75596c94db26e9e86d6fb222ce4de5e939c2195 URL: https://source.winehq.org/git/wine.git/?a=commit;h=a75596c94db26e9e86d6fb222...
Author: Martin Storsjo martin@martin.st Date: Wed Aug 19 23:57:06 2020 +0300
loader: Fix the generic case in get_self_exe().
Previously this just returned the matched directory, not the path to the executable itself.
Signed-off-by: Martin Storsjo martin@martin.st Signed-off-by: Alexandre Julliard julliard@winehq.org
---
loader/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/loader/main.c b/loader/main.c index 0e6b6f66b5..3c06728504 100644 --- a/loader/main.c +++ b/loader/main.c @@ -216,13 +216,15 @@ static const char *get_self_exe( char *argv0 ) for (p = strtok( path, ":" ); p; p = strtok( NULL, ":" )) { char *name = build_path( p, argv0 ); - int found = !access( name, X_OK ); + if (!access( name, X_OK )) + { + free( path ); + return name; + } free( name ); - if (found) break; } - if (p) p = strdup( p ); free( path ); - return p; + return NULL; } return argv0; #endif