From 77e3b056d76bc386c1d2375198a8c6b67b682600 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 23 Jan 2020 00:37:16 +0100 Subject: [PATCH] weston-launch: get ttynr also when no user is given In case an user is given but no tty, the code opens tty0 to allocate a new tty. With that ttynr is known. In case a tty name is given the user must be given too. In this case we later recover the ttynr by using stat on the file tty file descriptor which allows as to find the ttynr by looking at the devices minor number. However, the third case, when no user and no tty name is given, we do not get the ttynr. This hasn't been a problem in practise since ttynr has not been used. However, it makes sense to get the ttynr always for consistency. Also upcomming fixes will start to make use of ttynr. Fixes: 636156d5f693 ("weston-launch: Don't start new session unless -u is given") Signed-off-by: Stefan Agner --- libweston/weston-launch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c index 8d1aa39e..d014fc11 100644 --- a/libweston/weston-launch.c +++ b/libweston/weston-launch.c @@ -589,7 +589,7 @@ setup_tty(struct weston_launch *wl, const char *tty) return -1; } - if (tty) { + if (!wl->new_user || tty) { if (fstat(wl->tty, &buf) < 0) { fprintf(stderr, "weston: stat %s failed: %s\n", tty, strerror(errno));