From a8d8a63fe0b437a6a4d37fd03a0e8b4e178e22c7 Mon Sep 17 00:00:00 2001 From: n3rdopolis Date: Sat, 2 Dec 2017 10:50:00 -0500 Subject: Attempt to fix #454 With logind, only seat0 can use TTYs --- backend/session/logind.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'backend/session') diff --git a/backend/session/logind.c b/backend/session/logind.c index daff75b6..e42b85f8 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -347,19 +347,22 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) { 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; ret = sd_session_get_seat(session->id, &seat); if (ret < 0) { wlr_log(L_ERROR, "Failed to get seat id: %s", strerror(-ret)); goto error; } + 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); ret = sd_bus_default_system(&session->bus); -- cgit v1.2.3 From 8a2d54c24ab157c8acc669f6aa5af365abc71a70 Mon Sep 17 00:00:00 2001 From: n3rdopolis Date: Sat, 2 Dec 2017 12:37:28 -0500 Subject: Fix style and string comparison --- backend/session/logind.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'backend/session') diff --git a/backend/session/logind.c b/backend/session/logind.c index e42b85f8..e9d4c8f3 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -353,10 +353,9 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) { wlr_log(L_ERROR, "Failed to get seat id: %s", strerror(-ret)); goto error; } - snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat); - if (seat == "seat0") - { + + if (strcmp(seat, "seat0") == 0) { ret = sd_session_get_vt(session->id, &session->base.vtnr); if (ret < 0) { wlr_log(L_ERROR, "Session not running in virtual terminal"); -- cgit v1.2.3