From 80f14adb490cb5a78e96dc59eeebc6f36330ba29ffb974f7024c61e7001f5ca4 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Thu, 4 Dec 2008 11:41:50 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gdm?expand=0&rev=69 --- gdm-2.21.5-vt7-temporary-hack.patch | 12 --- gdm-vt-allocation-hack.patch | 118 ++++++++++++++++++++++++++++ gdm.changes | 8 ++ gdm.spec | 9 ++- 4 files changed, 133 insertions(+), 14 deletions(-) delete mode 100644 gdm-2.21.5-vt7-temporary-hack.patch create mode 100644 gdm-vt-allocation-hack.patch diff --git a/gdm-2.21.5-vt7-temporary-hack.patch b/gdm-2.21.5-vt7-temporary-hack.patch deleted file mode 100644 index 00585c2..0000000 --- a/gdm-2.21.5-vt7-temporary-hack.patch +++ /dev/null @@ -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; diff --git a/gdm-vt-allocation-hack.patch b/gdm-vt-allocation-hack.patch new file mode 100644 index 0000000..8450fc6 --- /dev/null +++ b/gdm-vt-allocation-hack.patch @@ -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 + #include + #include ++#include ++#include + + #include + #include +@@ -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; diff --git a/gdm.changes b/gdm.changes index e6d89b2..98880e1 100644 --- a/gdm.changes +++ b/gdm.changes @@ -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 diff --git a/gdm.spec b/gdm.spec index 6af8376..939bc65 100644 --- a/gdm.spec +++ b/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