This patch sets mode back to VT_AUTO and restores original terminal
in error handling routines
---
 src/tty.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/tty.c b/src/tty.c
index 78d5ba5..72d271a 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -237,6 +237,7 @@ tty_create(struct weston_compositor *compositor, 
tty_vt_func_t vt_func,
        return tty;
 
 err_vtmode:
+       mode.mode = VT_AUTO;
        ioctl(tty->fd, VT_SETMODE, &mode);
 
 err_kdmode:
@@ -251,6 +252,10 @@ err_attr:
        tcsetattr(tty->fd, TCSANOW, &tty->terminal_attributes);
 
 err:
+       if (tty->has_vt && tty->vt != tty->starting_vt) {
+               ioctl(tty->fd, VT_ACTIVATE, tty->starting_vt);
+               ioctl(tty->fd, VT_WAITACTIVE, tty->starting_vt);
+       }
        close(tty->fd);
        free(tty);
        return NULL;
-- 
1.7.10.2

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to