mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
tools/power/x86/intel-speed-select: Handle open() failure case
Add handling for open() failure case to make sure a valid file descriptor is passed to dup(). Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
b8bebc8e58
commit
364ba3b711
1 changed files with 2 additions and 0 deletions
|
@ -174,6 +174,8 @@ static void daemonize(char *rundir, char *pidfile)
|
|||
close(i);
|
||||
|
||||
i = open("/dev/null", O_RDWR);
|
||||
if (i < 0)
|
||||
exit(EXIT_FAILURE);
|
||||
ret = dup(i);
|
||||
if (ret == -1)
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
Loading…
Reference in a new issue