On 27 June 2018 at 00:39, nerdopolis <bluescreen_aven...@verizon.net> wrote: > As only seat0 supports TTYs, this changes the logind launcher where > it detects a TTY, only if the seat is seat0. This has only been > tested for logind > --- > libweston/launcher-logind.c | 22 ++++++++++++---------- > libweston/launcher-util.c | 4 ++++ > 2 files changed, 16 insertions(+), 10 deletions(-) > > diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c > index d0559c8f..36a4e642 100644 > --- a/libweston/launcher-logind.c > +++ b/libweston/launcher-logind.c > @@ -762,18 +762,20 @@ launcher_logind_connect(struct weston_launcher **out, > struct weston_compositor * > free(t); > goto err_session; > } > - free(t); > > - r = weston_sd_session_get_vt(wl->sid, &wl->vtnr); > - if (r < 0) { > - weston_log("logind: session not running on a VT\n"); > - goto err_session; > - } else if (tty > 0 && wl->vtnr != (unsigned int )tty) { > - weston_log("logind: requested VT --tty=%d differs from real > session VT %u\n", > - tty, wl->vtnr); > - r = -EINVAL; > - goto err_session; > + if (!strcmp(t, "seat0")) { > + r = weston_sd_session_get_vt(wl->sid, &wl->vtnr); > + if (r < 0) { > + weston_log("logind: session not running on a VT\n"); > + goto err_session; > + } else if (tty > 0 && wl->vtnr != (unsigned int )tty) { > + weston_log("logind: requested VT --tty=%d differs > from real session VT %u\n", > + tty, wl->vtnr); > + r = -EINVAL; > + goto err_session; > + } > } > + free(t); > t is leaked in the error paths. The briefest way to handle is r = strcmp(...); free(t); if (r == 0) { existing_get_vt_code }
-Emil _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel