This commit is contained in:
parent
726d495c80
commit
80f14adb49
@ -1,12 +0,0 @@
|
||||
diff -upr gdm-2.21.5-pre/daemon/gdm-server.c gdm-2.21.5-post/daemon/gdm-server.c
|
||||
--- gdm-2.21.5-pre/daemon/gdm-server.c 2007-11-19 15:53:12.000000000 -0600
|
||||
+++ gdm-2.21.5-post/daemon/gdm-server.c 2008-01-21 20:18:31.000000000 -0600
|
||||
@@ -306,6 +306,8 @@ gdm_server_resolve_command_line (GdmServ
|
||||
|
||||
if (vtarg != NULL && ! gotvtarg) {
|
||||
argv[len++] = g_strdup (vtarg);
|
||||
+ } else if (!query_in_arglist && !gotvtarg) {
|
||||
+ argv[len++] = g_strdup ("vt7");
|
||||
}
|
||||
|
||||
argv[len++] = NULL;
|
118
gdm-vt-allocation-hack.patch
Normal file
118
gdm-vt-allocation-hack.patch
Normal file
@ -0,0 +1,118 @@
|
||||
diff --git a/daemon/gdm-server.c b/daemon/gdm-server.c
|
||||
index 39def47..03488fd 100644
|
||||
--- a/daemon/gdm-server.c
|
||||
+++ b/daemon/gdm-server.c
|
||||
@@ -33,6 +33,8 @@
|
||||
#include <grp.h>
|
||||
#include <signal.h>
|
||||
#include <sys/resource.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+#include <sys/vt.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
@@ -150,6 +152,92 @@ _gdm_server_query_ck_for_display_device (GdmServer *server)
|
||||
return out;
|
||||
}
|
||||
|
||||
+#ifndef O_NOCTTY
|
||||
+# define O_NOCTTY 0
|
||||
+#endif
|
||||
+
|
||||
+static int
|
||||
+open_vt (int vtno)
|
||||
+{
|
||||
+ char *vtname;
|
||||
+ int fd;
|
||||
+
|
||||
+ vtname = g_strdup_printf ("/dev/tty%d", vtno);
|
||||
+
|
||||
+ do {
|
||||
+ errno = 0;
|
||||
+ fd = open (vtname, O_RDWR | O_NOCTTY, 0);
|
||||
+ } while (errno == EINTR);
|
||||
+
|
||||
+ g_free (vtname);
|
||||
+ return fd;
|
||||
+}
|
||||
+
|
||||
+static gint
|
||||
+find_first_probably_free_vt (void)
|
||||
+{
|
||||
+ int fd, fdv;
|
||||
+ int vtno;
|
||||
+ unsigned short vtmask;
|
||||
+ struct vt_stat vtstat;
|
||||
+ guint v_state;
|
||||
+
|
||||
+ fdv = -1;
|
||||
+
|
||||
+ do {
|
||||
+ errno = 0;
|
||||
+ fd = open ("/dev/console", O_WRONLY | O_NOCTTY, 0);
|
||||
+ } while (errno == EINTR);
|
||||
+
|
||||
+ if (fd >= 0) {
|
||||
+ if (ioctl (fd, VT_GETSTATE, &vtstat) >= 0) {
|
||||
+ v_state = vtstat.v_state;
|
||||
+ } else {
|
||||
+ close (fd);
|
||||
+ v_state = 0;
|
||||
+ fd = -1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ v_state = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (fd < 0) {
|
||||
+ do {
|
||||
+ errno = 0;
|
||||
+ fd = open ("/dev/console", O_RDONLY | O_NOCTTY, 0);
|
||||
+ } while (errno == EINTR);
|
||||
+
|
||||
+ if (fd >= 0) {
|
||||
+ if (ioctl (fd, VT_GETSTATE, &vtstat) >= 0)
|
||||
+ v_state = vtstat.v_state;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (vtno = 7, vtmask = 1 << vtno; vtmask; vtno++, vtmask <<= 1) {
|
||||
+ /* Is this console in use? */
|
||||
+ if (v_state & vtmask)
|
||||
+ continue;
|
||||
+
|
||||
+ /* No, try to open it */
|
||||
+ fdv = open_vt (vtno);
|
||||
+ if (fdv >= 0)
|
||||
+ break;
|
||||
+
|
||||
+ /* If we're here, kernel indicated that the console was free,
|
||||
+ * but we failed to open it. Just go on to higher VTs. */
|
||||
+ }
|
||||
+
|
||||
+ if (fdv >= 0)
|
||||
+ close (fdv);
|
||||
+ else
|
||||
+ vtno = -1;
|
||||
+
|
||||
+ if (fd >= 0)
|
||||
+ close (fd);
|
||||
+
|
||||
+ return vtno;
|
||||
+}
|
||||
+
|
||||
char *
|
||||
gdm_server_get_display_device (GdmServer *server)
|
||||
{
|
||||
@@ -310,6 +398,11 @@ gdm_server_resolve_command_line (GdmServer *server,
|
||||
|
||||
if (vtarg != NULL && ! gotvtarg) {
|
||||
argv[len++] = g_strdup (vtarg);
|
||||
+ } else if (!query_in_arglist && !gotvtarg) {
|
||||
+ gint vtnum = find_first_probably_free_vt ();
|
||||
+
|
||||
+ if (vtnum > 0)
|
||||
+ argv [len++] = g_strdup_printf ("vt%d", vtnum);
|
||||
}
|
||||
|
||||
argv[len++] = NULL;
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 4 01:26:30 CST 2008 - hpj@novell.com
|
||||
|
||||
- Replace gdm-2.21.5-vt7-temporary-hack.patch with
|
||||
gdm-vt-allocation-hack.patch. The new patch doesn't hardcode gdm
|
||||
to VT7, but instead scans for a free VT starting with VT7
|
||||
(bnc#434598).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Nov 30 22:55:57 CST 2008 - hpj@novell.com
|
||||
|
||||
|
9
gdm.spec
9
gdm.spec
@ -57,7 +57,7 @@ PreReq: %insserv_prereq
|
||||
License: GPL v2 or later
|
||||
Group: System/GUI/GNOME
|
||||
Version: 2.24.0
|
||||
Release: 13
|
||||
Release: 14
|
||||
Summary: The GNOME 2.x Display Manager
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
Source1: gdm.pamd
|
||||
@ -68,7 +68,7 @@ Source5: sysconfig.displaymanager-gdm
|
||||
Patch1: gdm-consolekit-helper-subdir.patch
|
||||
Patch2: gdm-2.21.9-no-fatal-warnings.patch
|
||||
Patch3: gdm-xauthlocalhostname.patch
|
||||
Patch4: gdm-2.21.5-vt7-temporary-hack.patch
|
||||
Patch4: gdm-vt-allocation-hack.patch
|
||||
Patch5: gdm-2.23.92-gsd-path.patch
|
||||
# PATCH-FIX-OPENSUSE gdm-desktop-session-env-pam.patch bnc427744 vuntz@novell.com -- Sets a PAM environment variable to let the pam gnome-keyring module know which session is started
|
||||
Patch6: gdm-desktop-session-env-pam.patch
|
||||
@ -286,6 +286,11 @@ fi
|
||||
%files lang -f %{name}.lang
|
||||
|
||||
%changelog
|
||||
* Thu Dec 04 2008 hpj@novell.com
|
||||
- Replace gdm-2.21.5-vt7-temporary-hack.patch with
|
||||
gdm-vt-allocation-hack.patch. The new patch doesn't hardcode gdm
|
||||
to VT7, but instead scans for a free VT starting with VT7
|
||||
(bnc#434598).
|
||||
* Sun Nov 30 2008 hpj@novell.com
|
||||
- Update gdm-sysconfig-settings.patch to translate the name of the
|
||||
configured system keymap into something libxklavier can
|
||||
|
Loading…
x
Reference in New Issue
Block a user