[PATCH alt 1] loader: Fix the generic case in get_self_exe()
Martin Storsjo
martin at martin.st
Wed Aug 19 15:57:06 CDT 2020
Previously this just returned the matched directory, not the path
to the executable itself.
Signed-off-by: Martin Storsjo <martin at martin.st>
---
Slightly bigger modification, but more straightforward in the end.
---
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
--
2.24.3 (Apple Git-128)
More information about the wine-devel
mailing list