Commit a75596c9 authored by Martin Storsjo's avatar Martin Storsjo Committed by Alexandre Julliard

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: 's avatarMartin Storsjo <martin@martin.st> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 1721f0ff
...@@ -216,13 +216,15 @@ static const char *get_self_exe( char *argv0 ) ...@@ -216,13 +216,15 @@ static const char *get_self_exe( char *argv0 )
for (p = strtok( path, ":" ); p; p = strtok( NULL, ":" )) for (p = strtok( path, ":" ); p; p = strtok( NULL, ":" ))
{ {
char *name = build_path( p, argv0 ); char *name = build_path( p, argv0 );
int found = !access( name, X_OK ); if (!access( name, X_OK ))
{
free( path );
return name;
}
free( name ); free( name );
if (found) break;
} }
if (p) p = strdup( p );
free( path ); free( path );
return p; return NULL;
} }
return argv0; return argv0;
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment