rpms/ConsoleKit/devel ConsoleKit-0.3.0-get-vt-from-display-instead-of-controlling-tty.patch, NONE, 1.1 ConsoleKit.spec, 1.32, 1.33

Ray Strode rstrode at fedoraproject.org
Tue Sep 16 15:16:53 UTC 2008


Author: rstrode

Update of /cvs/pkgs/rpms/ConsoleKit/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28909

Modified Files:
	ConsoleKit.spec 
Added Files:
	ConsoleKit-0.3.0-get-vt-from-display-instead-of-controlling-tty.patch 
Log Message:
- Grab X server display device from XFree86_VT root window property,
  if X server doesn't have a controlling terminal.


ConsoleKit-0.3.0-get-vt-from-display-instead-of-controlling-tty.patch:

--- NEW FILE ConsoleKit-0.3.0-get-vt-from-display-instead-of-controlling-tty.patch ---
diff --git a/tools/ck-get-x11-display-device.c b/tools/ck-get-x11-display-device.c
index b349cc7..eb2fec9 100644
--- a/tools/ck-get-x11-display-device.c
+++ b/tools/ck-get-x11-display-device.c
@@ -27,6 +27,7 @@
 #include <stdio.h>
 
 #include <X11/Xlib.h>
+#include <X11/Xatom.h>
 #include <glib.h>
 
 #include "ck-sysdeps.h"
@@ -78,6 +79,72 @@ display_init (const char *display_name)
         return xdisplay;
 }
 
+static char *
+get_tty_for_display (Display *xdisplay)
+{
+        Window root_window;
+        Atom xfree86_vt_atom;
+        Atom return_type_atom;
+        int return_format;
+        gulong return_count;
+        gulong bytes_left;
+        guchar *return_value;
+        glong vt;
+        char *display;
+
+        display = NULL;
+
+        xfree86_vt_atom = XInternAtom (xdisplay, "XFree86_VT", True);
+
+        if (xfree86_vt_atom == None) {
+                return NULL;
+        }
+
+        root_window = DefaultRootWindow (xdisplay);
+
+        g_assert (root_window != None);
+
+        return_value = NULL;
+        if (XGetWindowProperty(xdisplay, root_window, xfree86_vt_atom,
+                               0L, 1L, False, XA_INTEGER,
+                               &return_type_atom, &return_format,
+                               &return_count, &bytes_left,
+                               &return_value) != Success) {
+                goto out;
+        }
+
+        if (return_type_atom != XA_INTEGER) {
+                goto out;
+        }
+
+        if (return_format != 32) {
+                goto out;
+        }
+
+        if (return_count != 1) {
+                goto out;
+        }
+
+        if (bytes_left != 0) {
+                goto out;
+        }
+
+        vt = *((glong *) return_value);
+
+        if (vt <= 0) {
+                goto out;
+        }
+
+        display = g_strdup_printf ("/dev/tty%ld", vt);
+
+out:
+        if (return_value != NULL) {
+                XFree (return_value);
+        }
+
+        return display;
+}
+
 int
 main (int    argc,
       char **argv)
@@ -115,6 +182,11 @@ main (int    argc,
                 if (res) {
                         if (pid > 0) {
                                 device = get_tty_for_pid (pid);
+
+                                if (device == NULL) {
+                                        device = get_tty_for_display (xdisplay);
+                                }
+
                                 if (device != NULL) {
                                         printf ("%s\n", device);
                                         g_free (device);


Index: ConsoleKit.spec
===================================================================
RCS file: /cvs/pkgs/rpms/ConsoleKit/devel/ConsoleKit.spec,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- ConsoleKit.spec	31 Jul 2008 01:13:18 -0000	1.32
+++ ConsoleKit.spec	16 Sep 2008 15:16:23 -0000	1.33
@@ -6,7 +6,7 @@
 Summary: System daemon for tracking users, sessions and seats
 Name: ConsoleKit
 Version: 0.3.0
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv2+
 Group: System Environment/Libraries
 URL: http://www.freedesktop.org/wiki/Software/ConsoleKit
@@ -24,6 +24,8 @@
 BuildRequires: zlib-devel
 BuildRequires: xmlto
 
+Patch0: ConsoleKit-0.3.0-get-vt-from-display-instead-of-controlling-tty.patch
+
 %description
 ConsoleKit is a system daemon for tracking what users are logged
 into the system and how they interact with the computer (e.g.
@@ -75,6 +77,7 @@
 
 %prep
 %setup -q
+%patch0 -p1 -b .get-vt-from-display-instead-of-controlling-tty
 
 %build
 %configure --with-pid-file=%{_localstatedir}/run/console-kit-daemon.pid --enable-pam-module --with-pam-module-dir=/%{_lib}/security --enable-docbook-docs --docdir=%{_datadir}/doc/%{name}-%{version}
@@ -155,6 +158,10 @@
 %doc %{_datadir}/doc/%{name}-%{version}/spec/*
 
 %changelog
+* Tue Sep 16 2008 Ray Strode  <rstrode at redhat.com> - 0.3.0-2
+- Grab X server display device from XFree86_VT root window property,
+  if X server doesn't have a controlling terminal.
+
 * Wed Jul 30 2008 Jon McCann  <jmccann at redhat.com> - 0.3.0-1
 - Update to 0.3.0
 




More information about the fedora-extras-commits mailing list