weston-launch: quit if -t without -u

setup_tty() function uses the tty argument for choosing the tty/VT only
if wl->new_user (the -u option) is given. If the tty option is given
without -u, it will only be used for misleading error messages.

To make it clear to the user that -t without -u does not work the way
one might think, let weston-launch exit with an error in that case.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
Pekka Paalanen 2017-11-01 12:12:17 +02:00
parent 1fdeb68013
commit 5949e48d1d
1 changed files with 3 additions and 0 deletions

View File

@ -722,6 +722,9 @@ main(int argc, char *argv[])
if ((argc - optind) > (MAX_ARGV_SIZE - 6))
error(1, E2BIG, "Too many arguments to pass to weston");
if (tty && !wl.new_user)
error(1, 0, "-t/--tty option requires -u/--user option as well");
if (wl.new_user)
wl.pw = getpwnam(wl.new_user);
else