diff --git a/src/misc/unix/SDL_sysurl.c b/src/misc/unix/SDL_sysurl.c index 987f91ed8..198b425e8 100644 --- a/src/misc/unix/SDL_sysurl.c +++ b/src/misc/unix/SDL_sysurl.c @@ -33,11 +33,12 @@ SDL_SYS_OpenURL(const char *url) { const pid_t pid1 = fork(); if (pid1 == 0) { /* child process */ + pid_t pid2; + /* Clear LD_PRELOAD so Chrome opens correctly when this application is launched by Steam */ + unsetenv("LD_PRELOAD"); /* Notice this is vfork and not fork! */ - const pid_t pid2 = vfork(); + pid2 = vfork(); 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); _exit(EXIT_FAILURE); } else if (pid2 < 0) { /* There was an error forking */