mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-08-06 21:28:30 +02:00
Use run_external_process for the script execution
This protects the main process against script exection and allows more detailed error handling
This commit is contained in:
@@ -692,7 +692,8 @@ static void game_mode_execute_scripts(char scripts[CONFIG_LIST_MAX][CONFIG_VALUE
|
||||
while (*scripts[i] != '\0' && i < CONFIG_LIST_MAX) {
|
||||
LOG_MSG("Executing script [%s]\n", scripts[i]);
|
||||
int err;
|
||||
if ((err = system(scripts[i])) != 0) {
|
||||
const char *args[] = { "/bin/sh", "-c", scripts[i], NULL };
|
||||
if ((err = run_external_process(args)) != 0) {
|
||||
/* Log the failure, but this is not fatal */
|
||||
LOG_ERROR("Script [%s] failed with error %d\n", scripts[i], err);
|
||||
}
|
||||
|
Reference in New Issue
Block a user