Attempt to fix #454

With logind, only seat0 can use TTYs
This commit is contained in:
n3rdopolis 2017-12-02 10:50:00 -05:00 committed by GitHub
parent 779cccf8b4
commit a8d8a63fe0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -347,19 +347,22 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) {
goto error; goto error;
} }
ret = sd_session_get_vt(session->id, &session->base.vtnr);
if (ret < 0) {
wlr_log(L_ERROR, "Session not running in virtual terminal");
goto error;
}
char *seat; char *seat;
ret = sd_session_get_seat(session->id, &seat); ret = sd_session_get_seat(session->id, &seat);
if (ret < 0) { if (ret < 0) {
wlr_log(L_ERROR, "Failed to get seat id: %s", strerror(-ret)); wlr_log(L_ERROR, "Failed to get seat id: %s", strerror(-ret));
goto error; goto error;
} }
snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat); snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat);
if (seat == "seat0")
{
ret = sd_session_get_vt(session->id, &session->base.vtnr);
if (ret < 0) {
wlr_log(L_ERROR, "Session not running in virtual terminal");
goto error;
}
}
free(seat); free(seat);
ret = sd_bus_default_system(&session->bus); ret = sd_bus_default_system(&session->bus);