mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-15 23:22:53 +08:00
Handle error opening /dev/null in redirect_tty_output
This fixes coverity scan defect number 7520299
This commit is contained in:
parent
3083e0ea80
commit
fbc6c68f3d
@ -2091,6 +2091,9 @@ bool fish_reserved_codepoint(wchar_t c) {
|
||||
void redirect_tty_output() {
|
||||
struct termios t;
|
||||
int fd = open("/dev/null", O_WRONLY);
|
||||
if (fd == -1) {
|
||||
__fish_assert("Could not open /dev/null!", __FILE__, __LINE__, errno);
|
||||
}
|
||||
if (tcgetattr(STDIN_FILENO, &t) == -1 && errno == EIO) dup2(fd, STDIN_FILENO);
|
||||
if (tcgetattr(STDOUT_FILENO, &t) == -1 && errno == EIO) dup2(fd, STDOUT_FILENO);
|
||||
if (tcgetattr(STDERR_FILENO, &t) == -1 && errno == EIO) dup2(fd, STDERR_FILENO);
|
||||
|
Loading…
x
Reference in New Issue
Block a user