File gdm-failed-gracefully-booting-from-snapshot.patch of Package gdm.16051

diff --git a/daemon/main.c b/daemon/main.c
index 43625d6..25ad8a6 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -177,6 +177,23 @@ ensure_dir_with_perms (const char *path,
         return ret;
 }
 
+#ifdef  WITH_PLYMOUTH
+static void
+plymouth_quit ()
+{
+        gboolean res;
+        GError  *error;
+
+        error = NULL;
+        res = g_spawn_command_line_sync ("/bin/plymouth quit",
+                                         NULL, NULL, NULL, &error);
+        if (! res) {
+                g_warning ("Could not quit plymouth: %s", error->message);
+                g_error_free (error);
+        }
+}
+#endif
+
 static void
 gdm_daemon_ensure_dirs (uid_t uid,
                         gid_t gid)
@@ -194,6 +211,17 @@ gdm_daemon_ensure_dirs (uid_t uid,
                 gdm_fail (_("Failed to create LogDir %s: %s"),
                           LOGDIR, error->message);
         }
+
+        /* Test read-only /var/lib/gdm */
+        if (!ensure_dir_with_perms ("/var/lib/gdm/test", 0, gid, 0711, &error)) {
+                gdm_fail (_("GDM exit. %s: %s"),
+                          "/var/lib/gdm", error->message);
+#ifdef  WITH_PLYMOUTH
+                plymouth_quit ();
+#endif
+                exit (-1);
+        }
+        g_rmdir ("/var/lib/gdm/test");
 }
 
 static void