From f96870fe902be4824527ec41e0f4f9ec1bc765ef Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sat, 10 Nov 2012 18:11:16 +0100 Subject: [PATCH] uterm: vt: do not modify TTY settings We do not use the TTY for anything except VT functions. Hence, there is no need to modify the TTY settings before using it. Signed-off-by: David Herrmann --- src/uterm_vt.c | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/uterm_vt.c b/src/uterm_vt.c index d35855e..038d7a7 100644 --- a/src/uterm_vt.c +++ b/src/uterm_vt.c @@ -67,7 +67,6 @@ struct uterm_vt { int real_num; int real_saved_num; int real_kbmode; - struct termios real_saved_attribs; struct ev_fd *real_efd; bool real_delayed; }; @@ -312,7 +311,6 @@ static int open_tty(const char *dev, int *tty_fd, int *tty_num) static int real_open(struct uterm_vt *vt, const char *vt_for_seat0) { - struct termios raw_attribs; struct vt_mode mode; struct vt_stat vts; int ret; @@ -338,26 +336,10 @@ static int real_open(struct uterm_vt *vt, const char *vt_for_seat0) } vt->real_saved_num = vts.v_active; - if (tcgetattr(vt->real_fd, &vt->real_saved_attribs) < 0) { - log_err("cannot get terminal attributes (%d): %m", errno); - ret = -EFAULT; - goto err_eloop; - } - - /* Ignore control characters and disable echo */ - raw_attribs = vt->real_saved_attribs; - cfmakeraw(&raw_attribs); - - /* Fix up line endings to be normal (cfmakeraw hoses them) */ - raw_attribs.c_oflag |= OPOST | OCRNL; - - if (tcsetattr(vt->real_fd, TCSANOW, &raw_attribs) < 0) - log_warn("cannot put terminal into raw mode (%d): %m", errno); - if (ioctl(vt->real_fd, KDSETMODE, KD_GRAPHICS)) { log_err("cannot put VT in graphics mode (%d): %m", errno); ret = -errno; - goto err_reset; + goto err_eloop; } memset(&mode, 0, sizeof(mode)); @@ -421,11 +403,6 @@ err_text: if (ret) log_warning("cannot reset VT %d to text-mode (%d): %m", vt->real_num, errno); -err_reset: - ret = tcsetattr(vt->real_fd, TCSANOW, &vt->real_saved_attribs); - if (ret) - log_warning("cannot reset VT %d attributes (%d): %m", - vt->real_num, errno); err_eloop: ev_eloop_rm_fd(vt->real_efd); vt->real_efd = NULL; @@ -465,11 +442,6 @@ static void real_close(struct uterm_vt *vt) log_warning("cannot reset VT %d to text-mode (%d): %m", vt->real_num, errno); - ret = tcsetattr(vt->real_fd, TCSANOW, &vt->real_saved_attribs); - if (ret) - log_warning("cannot reset VT %d attributes (%d): %m", - vt->real_num, errno); - ev_eloop_rm_fd(vt->real_efd); vt->real_efd = NULL; close(vt->real_fd);