Index: gui/gdmflexiserver.c
===================================================================
--- gui/gdmflexiserver.c	(revision 5545)
+++ gui/gdmflexiserver.c	(working copy)
@@ -736,7 +736,6 @@
 	}
 }
 
-
 int
 main (int argc, char *argv[])
 {
@@ -745,18 +744,17 @@
 	char *version;
 	char *ret;
 	const char *message;
-	gboolean    initialized;
+	GOptionContext *ctx;
 
 	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
-	initialized = gtk_init_with_args (&argc,
-					  &argv,
-					  "- New gdm login",
-					  options,
-					  GETTEXT_PACKAGE,
-					  NULL);
+	/* Option parsing */
+	ctx = g_option_context_new ("- New gdm login");
+	g_option_context_add_main_entries (ctx, options, _("main options"));
+	g_option_context_parse (ctx, &argc, &argv, NULL);
+	g_option_context_free (ctx);
 
 	if (monte_carlo_pi) {
 		calc_pi ();
@@ -776,12 +774,15 @@
 			return 1;
 		}
 	} else {
+		/*
+		 * The --command argument does not display anything, so avoid
+		 * running gtk_init until it finishes.  Sometimes the
+		 * --command argument is used when there is no display so it
+		 * will fail and cause the program to exit, complaining about
+		 * "no display".
+		 */
+		gtk_init (&argc, &argv);
 
-		if (! initialized) {
-			g_warning ("Unable to open a display");
-			exit (1);
-		}
-
 		if ( ! gdmcomm_check (TRUE)) {
 			return 1;
 		}
@@ -791,6 +792,9 @@
 	gdmcomm_comm_bulk_start ();
 
 	/* Process --command option */
+
+	g_type_init ();
+
 	if (send_command != NULL) {
 		if (authenticate)
 			auth_cookie = gdmcomm_get_auth_cookie ();
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 5547)
+++ ChangeLog	(working copy)
@@ -1,5 +1,10 @@
 2007-12-10 Brian Cameron <brian.cameron@sun.com>
 
+	* gui/gdmflexiserver.c: Revert to the old logic for handling 
+	  options.  This uses g_option_context* rather than gtk_init.
+
+2007-12-10 Brian Cameron <brian.cameron@sun.com>
+
 	* gui/gdmlogin.c, gui/greeter/greeter.c: Now "Esc" key acts like the
 	  "Start Again" button.  Fixes enhancement request #482642.  Patch by
 	  Ray Strode <rstrode@redhat.com>.
