Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > d043847aa27480c55fe107cb41a6f83f > files > 27

gdm-2.32.1-1.1.mga1.src.rpm

Index: gdm-2.28.0/daemon/gdm-static-display.c
===================================================================
--- gdm-2.28.0.orig/daemon/gdm-static-display.c
+++ gdm-2.28.0/daemon/gdm-static-display.c
@@ -26,6 +26,7 @@
 #include <fcntl.h>
 #include <pwd.h>
 #include <unistd.h>
+#include <utmp.h>
 #include <string.h>
 #include <signal.h>
 #include <sys/stat.h>
@@ -96,6 +97,29 @@ gdm_static_display_manage (GdmDisplay *d
 }
 
 static gboolean
+gdm_static_display_should_manage_again (void)
+{
+        struct utmp *ut;
+
+        setutent();
+        while ((ut = getutent()) != NULL) {
+                if (ut->ut_type == RUN_LVL) {
+                        char current;
+                        current = ut->ut_pid % 256;
+                        endutent();
+
+                        if (current == '0' || current == '6')
+                                return FALSE;
+                        return TRUE;
+                }
+        }
+
+        endutent();
+
+        return TRUE;
+}
+
+static gboolean
 gdm_static_display_finish (GdmDisplay *display)
 {
         int status;
@@ -108,9 +132,11 @@ gdm_static_display_finish (GdmDisplay *d
         /* restart static displays */
         gdm_display_unmanage (display);
 
-        status = gdm_display_get_status (display);
-        if (status != GDM_DISPLAY_FAILED) {
-                gdm_display_manage (display);
+        if (gdm_static_display_should_manage_again ()) {
+                status = gdm_display_get_status (display);
+                if (status != GDM_DISPLAY_FAILED) {
+                        gdm_display_manage (display);
+                }
         }
 
         return TRUE;