Skip to content

Commit

Permalink
Use setenvinstead as putenv makes Lutris' wine crash for some rea…
Browse files Browse the repository at this point in the history
…son (threading?)
  • Loading branch information
jackun committed Aug 16, 2020
1 parent 4f64e14 commit e56b7de
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,18 +727,13 @@ void init_system_info(){
char *dir = dirname((char*)wineProcess.c_str());
stringstream findVersion;
findVersion << "\"" << dir << "/wine\" --version";
bool env_exists = false;
if (getenv("WINELOADERNOEXEC")) {
static char removenoexec[] = "WINELOADERNOEXEC";
putenv(removenoexec);
env_exists = true;
}
const char *wine_env = getenv("WINELOADERNOEXEC");
if (wine_env)
unsetenv("WINELOADERNOEXEC");
wineVersion = exec(findVersion.str());
std::cout << "WINE VERSION = " << wineVersion << "\n";
if (env_exists) {
static char noexec[] = "WINELOADERNOEXEC=1";
putenv(noexec);
}
if (wine_env)
setenv("WINELOADERNOEXEC", wine_env, 1);
}
}
else {
Expand Down

0 comments on commit e56b7de

Please sign in to comment.