mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-15 12:06:12 +00:00
terminal: lxc_setup_tios()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
ea5b3c2335
commit
e4953e62da
@ -473,16 +473,18 @@ int lxc_terminal_mainloop_add(struct lxc_epoll_descr *descr,
|
|||||||
|
|
||||||
int lxc_setup_tios(int fd, struct termios *oldtios)
|
int lxc_setup_tios(int fd, struct termios *oldtios)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
struct termios newtios;
|
struct termios newtios;
|
||||||
|
|
||||||
if (!isatty(fd)) {
|
if (!isatty(fd)) {
|
||||||
ERROR("'%d' is not a tty", fd);
|
ERROR("File descriptor %d does not refert to a terminal", fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get current termios */
|
/* Get current termios. */
|
||||||
if (tcgetattr(fd, oldtios)) {
|
ret = tcgetattr(fd, oldtios);
|
||||||
SYSERROR("failed to get current terminal settings");
|
if (ret < 0) {
|
||||||
|
SYSERROR("Failed to get current terminal settings");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,8 +513,9 @@ int lxc_setup_tios(int fd, struct termios *oldtios)
|
|||||||
newtios.c_cc[VTIME] = 0;
|
newtios.c_cc[VTIME] = 0;
|
||||||
|
|
||||||
/* Set new attributes. */
|
/* Set new attributes. */
|
||||||
if (tcsetattr(fd, TCSAFLUSH, &newtios)) {
|
ret = tcsetattr(fd, TCSAFLUSH, &newtios);
|
||||||
ERROR("failed to set new terminal settings");
|
if (ret < 0) {
|
||||||
|
ERROR("Failed to set new terminal settings");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user