[gdm/wip/wayland: 10/10] worker: try to old the mutter tty open to prevent logind from spawning a getty on it



commit bddf928d3c21c64faccb9e5432a1a5cab7bbec41
Author: Ray Strode <rstrode redhat com>
Date:   Thu Sep 19 00:36:04 2013 -0400

    worker: try to old the mutter tty open to prevent logind from spawning a getty on it

 daemon/gdm-session-worker.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 6b29734..6ec3e69 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -158,6 +158,7 @@ struct GdmSessionWorkerPrivate
         int               cred_flags;
         int               login_vt;
         int               session_vt;
+        int               session_tty_fd;
 
         char            **arguments;
         guint32           cancelled : 1;
@@ -1791,6 +1792,11 @@ gdm_session_worker_start_session (GdmSessionWorker  *worker,
                 jump_to_vt (worker, worker->priv->session_vt);
         }
 
+        if (worker->priv->session_tty_fd > 0) {
+                close (worker->priv->session_tty_fd);
+                worker->priv->session_tty_fd = -1;
+        }
+
         session_pid = fork ();
 
         if (session_pid < 0) {
@@ -1984,12 +1990,13 @@ set_up_for_new_vt (GdmSessionWorker *worker)
         g_assert (session_vt > 0);
 
         g_snprintf(vt_string, 256, "%d", session_vt);
-        g_snprintf(tty_string, 256, "tty%d", session_vt);
+        g_snprintf(tty_string, 256, "/dev/tty%d", session_vt);
 
         gdm_session_worker_set_environment_variable (worker,
                                                      "XDG_VTNR",
                                                      vt_string);
 
+        worker->priv->session_tty_fd = open (tty_string, O_RDWR | O_NOCTTY);
         pam_set_item (worker->priv->pam_handle, PAM_TTY, tty_string);
 
         return TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]