Commit aaa5b82e authored by Stefan Agner's avatar Stefan Agner Committed by Pekka Paalanen

weston-launch: do not close tty prematurely

The tty file descriptor is used in signal handling (when switching
VT via SIGUSR1/SIGUSR2 for the VT_RELDISP ioctrl) and in quit() when
weston-launch exits for the KDSKBMUTE/KDSKBMODE/KDSETMODE/VT_SETMODE
ioctrls.

This fixes VT switching when using weston-launch from a non-VT shell
(e.g. ssh or from within a container).
Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
parent 7df53497
......@@ -457,6 +457,9 @@ quit(struct weston_launch *wl, int status)
if (ioctl(wl->tty, VT_SETMODE, &mode) < 0)
fprintf(stderr, "could not reset vt handling\n");
if (wl->tty != STDIN_FILENO)
close(wl->tty);
exit(status);
}
......@@ -847,8 +850,6 @@ main(int argc, char *argv[])
launch_compositor(&wl, argc - optind, argv + optind);
close(wl.sock[1]);
if (wl.tty != STDIN_FILENO)
close(wl.tty);
while (1) {
struct pollfd fds[2];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment