From 72db3ac694c0f84f3c193df42e81be8329e52b61 Mon Sep 17 00:00:00 2001 From: nerdopolis Date: Wed, 20 Jan 2021 22:00:18 -0500 Subject: [PATCH] launcher-direct: handle seat0 without VTs This allows launcher-direct to run when seat0 has no TTYs This checks for a proper /dev/tty0 device as /dev/tty0 does not get created by kernels compiled with CONFIG_VT=n --- libweston/launcher-direct.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c index 8ed34f5f..c04ba857 100644 --- a/libweston/launcher-direct.c +++ b/libweston/launcher-direct.c @@ -304,6 +304,7 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor * int tty, const char *seat_id, bool sync_drm) { struct launcher_direct *launcher; + struct stat buf; launcher = zalloc(sizeof(*launcher)); if (launcher == NULL) { @@ -314,7 +315,11 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor * launcher->base.iface = &launcher_direct_iface; launcher->compositor = compositor; - if (strcmp("seat0", seat_id) == 0) { + /* Checking the existance of /dev/tty0 and verifying it's a TTY + * device, as kernels compiled with CONFIG_VT=0 do not create these + * devices. */ + if (stat("/dev/tty0", &buf) == 0 && + strcmp("seat0", seat_id) == 0 && major(buf.st_rdev) == TTY_MAJOR) { if (setup_tty(launcher, tty) == -1) { free(launcher); return -1;