Hello community, here is the log from the commit of package gdm for openSUSE:Factory checked in at Thu Dec 4 12:41:45 CET 2008. -------- --- GNOME/gdm/gdm.changes 2008-12-01 06:46:19.000000000 +0100 +++ /mounts/work_src_done/STABLE/gdm/gdm.changes 2008-12-04 08:43:16.000000000 +0100 @@ -1,0 +2,8 @@ +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). + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- gdm-2.21.5-vt7-temporary-hack.patch New: ---- gdm-vt-allocation-hack.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gdm.spec ++++++ --- /var/tmp/diff_new_pack.v25285/_old 2008-12-04 12:41:19.000000000 +0100 +++ /var/tmp/diff_new_pack.v25285/_new 2008-12-04 12:41:19.000000000 +0100 @@ -57,7 +57,7 @@ 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 @@ 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 @@ %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 ++++++ gdm-vt-allocation-hack.patch ++++++ 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; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org