Only set use tcsetattr() on TTYs for KISS TNCs
Fix patty_kiss_tnc_new_fd() to only attempt tcgetattr()/tcsetattr() on file descriptors for whom isatty() is true, allowing files and sockets to once again be used
This commit is contained in:
parent
e10ce6b8e1
commit
09df948871
1 changed files with 9 additions and 7 deletions
|
@ -52,6 +52,7 @@ patty_kiss_tnc *patty_kiss_tnc_new_fd(int fd) {
|
||||||
goto error_malloc_buf;
|
goto error_malloc_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isatty(fd)) {
|
||||||
if (tcgetattr(fd, &tnc->attrs) < 0) {
|
if (tcgetattr(fd, &tnc->attrs) < 0) {
|
||||||
goto error_tcgetattr;
|
goto error_tcgetattr;
|
||||||
}
|
}
|
||||||
|
@ -63,6 +64,7 @@ patty_kiss_tnc *patty_kiss_tnc_new_fd(int fd) {
|
||||||
if (tcsetattr(fd, TCSANOW, &tnc->attrs) < 0) {
|
if (tcsetattr(fd, TCSANOW, &tnc->attrs) < 0) {
|
||||||
goto error_tcsetattr;
|
goto error_tcsetattr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tnc->fd = fd;
|
tnc->fd = fd;
|
||||||
tnc->opts = TNC_NONE;
|
tnc->opts = TNC_NONE;
|
||||||
|
|
Loading…
Add table
Reference in a new issue