uterm: vt: fix resetting access control on VT-close

This is a weird fix. One would think that this is automatically reset when
calling close() on the fd but, suprise, it's not. So lets reset this
manually, otherwise when we close the VT but our application is still
active, the user will never be able to leave the VT again.

Again a hilarious example why the VT API sucks. Really... Get rid of it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-08-20 14:57:39 +02:00
parent 06d33f6636
commit 5dfc12ee6a

View File

@ -287,7 +287,14 @@ err_fd:
static void real_close(struct uterm_vt *vt)
{
struct vt_mode mode;
log_debug("closing vt %p", vt);
memset(&mode, 0, sizeof(mode));
mode.mode = VT_AUTO;
ioctl(vt->real_fd, VT_SETMODE, &mode);
ioctl(vt->real_fd, KDSETMODE, KD_TEXT);
tcsetattr(vt->real_fd, TCSANOW, &vt->real_saved_attribs);
ev_eloop_rm_fd(vt->real_efd);