mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
LibC: openpty error handling update
This commit is contained in:
parent
755393e684
commit
594dfaadb9
1 changed files with 14 additions and 4 deletions
|
@ -56,12 +56,22 @@ int openpty(int* amaster, int* aslave, char* name, const struct termios* termp,
|
|||
return -1;
|
||||
}
|
||||
if (termp) {
|
||||
// FIXME: error handling
|
||||
tcsetattr(*aslave, TCSAFLUSH, termp);
|
||||
if (tcsetattr(*aslave, TCSAFLUSH, termp) == -1) {
|
||||
int error = errno;
|
||||
close(*aslave);
|
||||
close(*amaster);
|
||||
errno = error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (winp) {
|
||||
// FIXME: error handling
|
||||
ioctl(*aslave, TIOCGWINSZ, winp);
|
||||
if (ioctl(*aslave, TIOCGWINSZ, winp) == -1) {
|
||||
int error = errno;
|
||||
close(*aslave);
|
||||
close(*amaster);
|
||||
errno = error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
dbgln("openpty, master={}, slave={}, tty_name={}", *amaster, *aslave, tty_name);
|
||||
|
|
Loading…
Add table
Reference in a new issue