--- gnome-session-2.28.0/gnome-session/main.c.orig	2010-01-21 21:58:56.417898230 +0800
+++ gnome-session-2.28.0/gnome-session/main.c	2010-01-22 16:12:45.847541903 +0800
@@ -329,6 +329,7 @@
            gpointer data)
 {
         int ret;
+        GsmManager *manager;
 
         g_debug ("Got callback for signal %d", signo);
 
@@ -343,9 +344,11 @@
                 break;
         case SIGINT:
         case SIGTERM:
+                manager = (GsmManager *)data;
+                gsm_manager_logout (manager, GSM_MANAGER_LOGOUT_MODE_FORCE, NULL);
                 /* let the fatal signals interrupt us */
                 g_debug ("Caught signal %d, shutting down normally.", signo);
-                ret = FALSE;
+                ret = TRUE;
                 break;
         case SIGHUP:
                 g_debug ("Got HUP signal");
@@ -543,14 +546,6 @@
         gdm_log_init ();
         gdm_log_set_debug (debug);
 
-        signal_handler = gdm_signal_handler_new ();
-        gdm_signal_handler_add_fatal (signal_handler);
-        gdm_signal_handler_add (signal_handler, SIGTERM, signal_cb, NULL);
-        gdm_signal_handler_add (signal_handler, SIGINT, signal_cb, NULL);
-        gdm_signal_handler_add (signal_handler, SIGFPE, signal_cb, NULL);
-        gdm_signal_handler_add (signal_handler, SIGHUP, signal_cb, NULL);
-        gdm_signal_handler_add (signal_handler, SIGUSR1, signal_cb, NULL);
-
         /* Set DISPLAY explicitly for all our children, in case --display
          * was specified on the command line.
          */
@@ -591,6 +586,13 @@
 
         manager = gsm_manager_new (client_store, failsafe);
 
+        signal_handler = gdm_signal_handler_new ();
+        gdm_signal_handler_add_fatal (signal_handler);
+        gdm_signal_handler_add (signal_handler, SIGFPE, signal_cb, NULL);
+        gdm_signal_handler_add (signal_handler, SIGHUP, signal_cb, NULL);
+        gdm_signal_handler_add (signal_handler, SIGUSR1, signal_cb, NULL);
+        gdm_signal_handler_add (signal_handler, SIGTERM, signal_cb, manager);
+        gdm_signal_handler_add (signal_handler, SIGINT, signal_cb, manager);
         gdm_signal_handler_set_fatal_func (signal_handler, shutdown_cb, manager);
 
         if (override_autostart_dirs != NULL) {
