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: Stefan Agner <stefan@agner.ch>
dev
Stefan Agner 5 years ago committed by Pekka Paalanen
parent 7df5349763
commit aaa5b82e61
  1. 5
      libweston/weston-launch.c

@ -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];

Loading…
Cancel
Save