summaryrefslogtreecommitdiff
path: root/src/weston-launch.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2013-10-02 13:06:02 -0700
committerKristian Høgsberg <krh@bitplanet.net>2013-10-02 13:06:02 -0700
commite05f228a5f60bdd41edfd92b12731a42110a5743 (patch)
tree05f7cd12799f63bc251b8140bbbc4ef22f508800 /src/weston-launch.c
parent6ff3ff57aa76aa8738383cbacc4e9f425e1da056 (diff)
downloadweston-e05f228a5f60bdd41edfd92b12731a42110a5743.tar.gz
launcher: Print a more descriptive error message when we don't get a VT
weston-launch has two supported use cases now: either launch from and VT login as a regular user (running within that session) or from an init script (systemd or such) with the -u option to create a session for the specified user. Running from within X or ssh is not possible. It's still possible to run weston as root from X or ssh but that's strictly a development/debug/test feature. https://bugs.freedesktop.org/show_bug.cgi?id=69727
Diffstat (limited to 'src/weston-launch.c')
-rw-r--r--src/weston-launch.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/weston-launch.c b/src/weston-launch.c
index 1b560af2..49b8964e 100644
--- a/src/weston-launch.c
+++ b/src/weston-launch.c
@@ -492,6 +492,10 @@ setup_tty(struct weston_launch *wl, const char *tty)
if (wl->tty < 0)
error(1, errno, "failed to open tty");
+ if (fstat(wl->tty, &buf) == -1 ||
+ major(buf.st_rdev) != TTY_MAJOR || minor(buf.st_rdev) == 0)
+ error(1, 0, "weston-launch must be run from a virtual terminal");
+
if (tty) {
if (fstat(wl->tty, &buf) < 0)
error(1, errno, "stat %s failed", tty);