diff --git a/daemon/gamemode-tests.c b/daemon/gamemode-tests.c index 5ebe394..2df541e 100644 --- a/daemon/gamemode-tests.c +++ b/daemon/gamemode-tests.c @@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include "daemon_config.h" +#include "external-helper.h" #include "gamemode_client.h" #include "governors-query.h" #include "gpu-control.h" @@ -370,7 +371,8 @@ static int run_custom_scripts_tests(struct GameModeConfig *config) while (*startscripts[i] != '\0' && i < CONFIG_LIST_MAX) { LOG_MSG(":::: Running start script [%s]\n", startscripts[i]); - int ret = system(startscripts[i]); + const char *args[] = { "/bin/sh", "-c", startscripts[i], NULL }; + int ret = run_external_process(args); if (ret == 0) LOG_MSG(":::: Passed\n"); @@ -392,7 +394,8 @@ static int run_custom_scripts_tests(struct GameModeConfig *config) while (*endscripts[i] != '\0' && i < CONFIG_LIST_MAX) { LOG_MSG(":::: Running end script [%s]\n", endscripts[i]); - int ret = system(endscripts[i]); + const char *args[] = { "/bin/sh", "-c", endscripts[i], NULL }; + int ret = run_external_process(args); if (ret == 0) LOG_MSG(":::: Passed\n"); diff --git a/daemon/gamemode.c b/daemon/gamemode.c index 076388b..f445374 100644 --- a/daemon/gamemode.c +++ b/daemon/gamemode.c @@ -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); }