launcher: Fail weston_launcher_create() if tty setup fails

This commit is contained in:
Kristian Høgsberg 2013-10-01 12:54:55 -07:00
parent 8b62e2043a
commit 19ec77aef7

View File

@ -250,6 +250,8 @@ setup_tty(struct weston_launcher *launcher)
if (fstat(STDIN_FILENO, &buf) == -1 ||
major(buf.st_rdev) != TTY_MAJOR || minor(buf.st_rdev) == 0) {
weston_log("stdin not a vt\n");
weston_log("if running weston from ssh, "
"use --tty to specify a tty\n");
return -1;
}
@ -319,7 +321,10 @@ weston_launcher_connect(struct weston_compositor *compositor)
return NULL;
}
} else if (geteuid() == 0) {
setup_tty(launcher);
if (setup_tty(launcher) == -1) {
free(launcher);
return NULL;
}
} else {
free(launcher);
return NULL;