mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-07-31 18:36:53 +02:00
Fix issues found by Coverity, closes #206.
This commit is contained in:
@@ -224,7 +224,8 @@ char *game_mode_resolve_wine_preloader(const char *exe, const pid_t pid)
|
||||
goto fail;
|
||||
|
||||
error_cleanup:
|
||||
game_mode_close_proc(proc_fd);
|
||||
if (proc_fd != INVALID_PROCFD)
|
||||
game_mode_close_proc(proc_fd);
|
||||
free(wineprefix);
|
||||
return wine_exe;
|
||||
|
||||
|
@@ -132,11 +132,19 @@ static void daemonize(const char *name)
|
||||
/* replace standard file descriptors by /dev/null */
|
||||
int devnull_r = open("/dev/null", O_RDONLY);
|
||||
int devnull_w = open("/dev/null", O_WRONLY);
|
||||
dup2(devnull_r, STDIN_FILENO);
|
||||
dup2(devnull_w, STDOUT_FILENO);
|
||||
dup2(devnull_w, STDERR_FILENO);
|
||||
close(devnull_r);
|
||||
close(devnull_w);
|
||||
|
||||
if (devnull_r == -1 || devnull_w == -1)
|
||||
{
|
||||
LOG_ERROR("Failed to redirect standard input and output to /dev/null\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
dup2(devnull_r, STDIN_FILENO);
|
||||
dup2(devnull_w, STDOUT_FILENO);
|
||||
dup2(devnull_w, STDERR_FILENO);
|
||||
close(devnull_r);
|
||||
close(devnull_w);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user