diff --git a/src/arch/ArchHooks/ArchHooks_Unix.cpp b/src/arch/ArchHooks/ArchHooks_Unix.cpp index 1374590f36..d835de1c1e 100644 --- a/src/arch/ArchHooks/ArchHooks_Unix.cpp +++ b/src/arch/ArchHooks/ArchHooks_Unix.cpp @@ -12,6 +12,8 @@ #include "archutils/Unix/AssertionHandler.h" #include #include +#include +#include #if defined(CRASH_HANDLER) #include "archutils/Unix/CrashHandler.h" @@ -200,9 +202,27 @@ void ArchHooks_Unix::Init() bool ArchHooks_Unix::GoToURL( RString sUrl ) { - RString command = "xdg-open " + sUrl; - int result = system( command.c_str() ); - return result != -1 && WEXITSTATUS( result ) == 0; + int status; + pid_t p = fork(); + if ( p == -1 ) + { + // Call to fork failed + return false; + } + else if ( p == 0 ) + { + // Child + const char * const argv[] = { "xdg-open", sUrl.c_str(), NULL }; + execv( "/usr/bin/xdg-open", const_cast( argv )); + // If we reach here, the call to execvp failed + exit( 1 ); + } + else + { + // Parent + waitpid( p, &status, 0 ); + return WEXITSTATUS( status ) == 0; + } } #ifndef _CS_GNU_LIBC_VERSION