Commit 77e3b056 authored by Stefan Agner's avatar Stefan Agner Committed by Pekka Paalanen
Browse files

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: 636156d5

 ("weston-launch: Don't start new session unless -u is given")
Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
parent aaa5b82e
......@@ -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));
......
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