Index: gdm-2.24.0/daemon/gdm-display-factory.c
===================================================================
--- gdm-2.24.0.orig/daemon/gdm-display-factory.c
+++ gdm-2.24.0/daemon/gdm-display-factory.c
@@ -34,11 +34,13 @@
 
 struct GdmDisplayFactoryPrivate
 {
+        int status;	
         GdmDisplayStore *display_store;
 };
 
 enum {
         PROP_0,
+        PROP_DISPLAY_FACTORY_STATUS,
         PROP_DISPLAY_STORE,
 };
 
@@ -67,6 +69,14 @@ gdm_display_factory_get_display_store (G
         return factory->priv->display_store;
 }
 
+int
+gdm_display_factory_get_status (GdmDisplayFactory *factory)
+{
+        g_return_val_if_fail (GDM_IS_DISPLAY_FACTORY (factory), GDM_DISPLAY_FACTORY_UNMANAGED);
+
+        return factory->priv->status;
+}
+
 gboolean
 gdm_display_factory_start (GdmDisplayFactory *factory)
 {
@@ -96,6 +106,21 @@ gdm_display_factory_stop (GdmDisplayFact
 }
 
 static void
+gdm_display_factory_set_status (GdmDisplayFactory *factory, int status)
+{
+        switch (factory->priv->status) {
+        case GDM_DISPLAY_FACTORY_UNMANAGED:
+                factory->priv->status = status;
+                g_object_notify (G_OBJECT (factory), "factory-status");
+                break;
+        case GDM_DISPLAY_FACTORY_MANAGED:
+        case GDM_DISPLAY_FACTORY_FAILED:
+                break;
+        }
+
+}
+
+static void
 gdm_display_factory_set_display_store (GdmDisplayFactory *factory,
                                        GdmDisplayStore   *display_store)
 {
@@ -120,6 +145,9 @@ gdm_display_factory_set_property (GObjec
         self = GDM_DISPLAY_FACTORY (object);
 
         switch (prop_id) {
+        case PROP_DISPLAY_FACTORY_STATUS:
+                gdm_display_factory_set_status (self, g_value_get_int (value));
+                break;
         case PROP_DISPLAY_STORE:
                 gdm_display_factory_set_display_store (self, g_value_get_object (value));
                 break;
@@ -140,6 +168,9 @@ gdm_display_factory_get_property (GObjec
         self = GDM_DISPLAY_FACTORY (object);
 
         switch (prop_id) {
+        case PROP_DISPLAY_FACTORY_STATUS:
+                g_value_set_int (value, self->priv->status);
+                break;
         case PROP_DISPLAY_STORE:
                 g_value_set_object (value, self->priv->display_store);
                 break;
@@ -159,6 +190,16 @@ gdm_display_factory_class_init (GdmDispl
         object_class->finalize = gdm_display_factory_finalize;
 
         g_object_class_install_property (object_class,
+                                         PROP_DISPLAY_FACTORY_STATUS,
+                                         g_param_spec_int ("factory-status",
+                                                           "factory status",
+                                                           "factory status",
+                                                           -1,
+                                                           G_MAXINT,
+                                                           GDM_DISPLAY_FACTORY_UNMANAGED,
+                                                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+        g_object_class_install_property (object_class,
                                          PROP_DISPLAY_STORE,
                                          g_param_spec_object ("display-store",
                                                               "display store",
@@ -173,6 +214,8 @@ static void
 gdm_display_factory_init (GdmDisplayFactory *factory)
 {
         factory->priv = GDM_DISPLAY_FACTORY_GET_PRIVATE (factory);
+
+        factory->priv->status = GDM_DISPLAY_FACTORY_UNMANAGED;
 }
 
 static void
Index: gdm-2.24.0/daemon/gdm-display-factory.h
===================================================================
--- gdm-2.24.0.orig/daemon/gdm-display-factory.h
+++ gdm-2.24.0/daemon/gdm-display-factory.h
@@ -37,6 +37,12 @@ G_BEGIN_DECLS
 
 typedef struct GdmDisplayFactoryPrivate GdmDisplayFactoryPrivate;
 
+typedef enum {
+        GDM_DISPLAY_FACTORY_UNMANAGED = 0,
+        GDM_DISPLAY_FACTORY_MANAGED,
+        GDM_DISPLAY_FACTORY_FAILED,
+} GdmDisplayFactoryStatus;
+
 typedef struct
 {
         GObject                   parent;
@@ -64,6 +70,7 @@ GType                      gdm_display_f
 gboolean                   gdm_display_factory_start                   (GdmDisplayFactory *manager);
 gboolean                   gdm_display_factory_stop                    (GdmDisplayFactory *manager);
 GdmDisplayStore *          gdm_display_factory_get_display_store       (GdmDisplayFactory *manager);
+int                        gdm_display_factory_get_status (GdmDisplayFactory *factory);
 
 G_END_DECLS
 
Index: gdm-2.24.0/daemon/gdm-local-display-factory.c
===================================================================
--- gdm-2.24.0.orig/daemon/gdm-local-display-factory.c
+++ gdm-2.24.0/daemon/gdm-local-display-factory.c
@@ -317,7 +317,8 @@ on_static_display_status_changed (GdmDis
                 if (factory->priv->num_failures > MAX_DISPLAY_FAILURES) {
                         /* oh shit */
                         g_warning ("GdmLocalDisplayFactory: maximum number of X display failures reached: check X server log for errors");
-                        exit (1);
+                        g_object_set (factory, "factory-status", GDM_DISPLAY_FACTORY_FAILED, NULL);
+                        return;
                 }
 
                 create_display (factory);
Index: gdm-2.24.0/daemon/gdm-manager.c
===================================================================
--- gdm-2.24.0.orig/daemon/gdm-manager.c
+++ gdm-2.24.0/daemon/gdm-manager.c
@@ -60,7 +60,9 @@ struct GdmManagerPrivate
         GdmXdmcpDisplayFactory *xdmcp_factory;
 #endif
         gboolean                xdmcp_enabled;
-	gboolean		local_enabled;
+        gboolean                local_enabled;
+        gboolean                xdmcp_running;
+        gboolean                local_running;
 
         gboolean                started;
         gboolean                wait_for_go;
@@ -156,6 +158,7 @@ gdm_manager_stop (GdmManager *manager)
 #endif
 
         manager->priv->started = FALSE;
+
 }
 
 void
@@ -164,8 +167,8 @@ gdm_manager_start (GdmManager *manager)
         g_debug ("GdmManager: GDM starting to manage displays");
 
         if (manager->priv->local_enabled && ! manager->priv->wait_for_go) {
-		if (manager->priv->local_factory != NULL)
-	                gdm_display_factory_start (GDM_DISPLAY_FACTORY (manager->priv->local_factory));
+                if (manager->priv->local_factory != NULL)
+	                manager->priv->local_running = gdm_display_factory_start (GDM_DISPLAY_FACTORY (manager->priv->local_factory));
         }
 
 #ifdef HAVE_LIBXDMCP
@@ -173,11 +176,14 @@ gdm_manager_start (GdmManager *manager)
         if (manager->priv->xdmcp_enabled && ! manager->priv->wait_for_go) {
                 if (manager->priv->xdmcp_factory != NULL) {
                         g_debug ("GdmManager: Accepting XDMCP connections...");
-                        gdm_display_factory_start (GDM_DISPLAY_FACTORY (manager->priv->xdmcp_factory));
+                        manager->priv->xdmcp_running = gdm_display_factory_start (GDM_DISPLAY_FACTORY (manager->priv->xdmcp_factory));
                 }
         }
 #endif
 
+        if (!manager->priv->local_running && !manager->priv->xdmcp_running)
+                exit (1);
+
         manager->priv->started = TRUE;
 }
 
@@ -388,6 +394,26 @@ gdm_manager_get_property (GObject    *ob
         }
 }
 
+static void
+on_local_factory_status_changed (GdmDisplayFactory *factory, gpointer user_data)
+{
+        int status;
+        GdmManager *manager;
+        
+        status = gdm_display_factory_get_status (GDM_DISPLAY_FACTORY (factory));
+
+        if (status == GDM_DISPLAY_FACTORY_FAILED) {
+                manager = GDM_MANAGER (manager_object);
+                manager->priv->local_running = FALSE;
+                gdm_display_factory_stop (GDM_DISPLAY_FACTORY (manager->priv->local_factory));
+                g_object_unref (manager->priv->local_factory);
+                manager->priv->local_factory = NULL;
+
+                if (manager->priv->xdmcp_running == FALSE)
+                        exit (1);
+        }
+}
+
 static GObject *
 gdm_manager_constructor (GType                  type,
                          guint                  n_construct_properties,
@@ -401,6 +427,7 @@ gdm_manager_constructor (GType
 
 	if (manager->priv->local_enabled) {
 	        manager->priv->local_factory = gdm_local_display_factory_new (manager->priv->display_store);
+                g_signal_connect (manager->priv->local_factory, "notify::factory-status", G_CALLBACK (on_local_factory_status_changed), NULL);
 	}
 
 #ifdef HAVE_LIBXDMCP
@@ -471,6 +498,9 @@ gdm_manager_init (GdmManager *manager)
         manager->priv = GDM_MANAGER_GET_PRIVATE (manager);
 
         manager->priv->display_store = gdm_display_store_new ();
+
+        manager->priv->local_running = FALSE;
+        manager->priv->xdmcp_running = FALSE;
 }
 
 static void
