Clear LD_PRELOAD so Chrome opens correctly when this application is launched by Steam

This fixes https://github.com/libsdl-org/SDL/issues/4565
This commit is contained in:
Sam Lantinga 2021-07-31 23:28:41 -07:00
parent 54aea2446e
commit 9b7b928765
1 changed files with 2 additions and 0 deletions

View File

@ -36,6 +36,8 @@ SDL_SYS_OpenURL(const char *url)
/* Notice this is vfork and not fork! */ /* Notice this is vfork and not fork! */
const pid_t pid2 = vfork(); const pid_t pid2 = vfork();
if (pid2 == 0) { /* Grandchild process will try to launch the url */ if (pid2 == 0) { /* Grandchild process will try to launch the url */
/* Clear LD_PRELOAD so Chrome opens correctly when this application is launched by Steam */
unsetenv("LD_PRELOAD");
execlp("xdg-open", "xdg-open", url, NULL); execlp("xdg-open", "xdg-open", url, NULL);
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
} else if (pid2 < 0) { /* There was an error forking */ } else if (pid2 < 0) { /* There was an error forking */