[mutter/wayland] mutter-launch: fix for more systemd API changes
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] mutter-launch: fix for more systemd API changes
- Date: Mon, 16 Sep 2013 15:31:06 +0000 (UTC)
commit 24074a81d0a10261a99c2cc9167809cc27253573
Author: Giovanni Campagna <gcampagn redhat com>
Date: Mon Sep 16 17:21:34 2013 +0200
mutter-launch: fix for more systemd API changes
Modern systemd changed the semantics of sd_session_get_tty() to
return the full path, rather than just the tty name.
Reviewed by Ray Strode in IRC.
src/wayland/weston-launch.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/weston-launch.c b/src/wayland/weston-launch.c
index 52019d4..3cb4226 100644
--- a/src/wayland/weston-launch.c
+++ b/src/wayland/weston-launch.c
@@ -566,7 +566,18 @@ setup_tty(struct weston_launch *wl)
ok = sd_session_get_tty(session, &tty);
if (ok == 0) {
- snprintf(path, PATH_MAX, "/dev/%s", tty);
+ /* Old systemd only has the tty name in the TTY
+ field, new one has the full char device path.
+
+ Check what we have and fix it properly.
+ */
+ if (strncmp(tty, "/dev", strlen("/dev")) == 0) {
+ strncpy(path, tty, PATH_MAX);
+ path[PATH_MAX-1] = 0;
+ } else {
+ snprintf(path, PATH_MAX, "/dev/%s", tty);
+ }
+
wl->tty = open(path, O_RDWR | O_NOCTTY | O_CLOEXEC);
free(tty);
#ifdef HAVE_SD_SESSION_GET_VT
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]