[gdm] session-worker: drop SIGINT and rework SIGTERM handler



commit 6b8586958a97c0a72b9c8bae3c73b945089dfa3d
Author: Vasily Khoruzhick <vasilykh arista com>
Date:   Wed Sep 23 13:50:13 2015 -0700

    session-worker: drop SIGINT and rework SIGTERM handler
    
    The gdm session worker sets up main loop dispatched signal
    handlers for SIGINT and SIGTERM.  These handlers won't run
    if the pam module is blocking, since the main loop isn't
    iterating.
    
    This commit drops the SIGINT handler, and changes the SIGTERM
    handler to exit with a successful exit code, which gives us
    the same effective behavior as before but will work even
    if the pam module is blocked.
    
    Small changes by Ray Strode
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755291

 daemon/session-worker-main.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/daemon/session-worker-main.c b/daemon/session-worker-main.c
index ede60c5..051d7f9 100644
--- a/daemon/session-worker-main.c
+++ b/daemon/session-worker-main.c
@@ -27,6 +27,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <signal.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <locale.h>
@@ -46,16 +47,6 @@
 static GdmSettings *settings = NULL;
 
 static gboolean
-on_shutdown_signal_cb (gpointer user_data)
-{
-        GMainLoop *mainloop = user_data;
-
-        g_main_loop_quit (mainloop);
-
-        return FALSE;
-}
-
-static gboolean
 on_sigusr1_cb (gpointer user_data)
 {
         g_debug ("Got USR1 signal");
@@ -73,6 +64,12 @@ is_debug_set (void)
         return debug;
 }
 
+static void
+on_sigterm_cb (int signal_number)
+{
+        _exit (0);
+}
+
 int
 main (int    argc,
       char **argv)
@@ -86,6 +83,8 @@ main (int    argc,
                 { NULL }
         };
 
+        signal (SIGTERM, on_sigterm_cb);
+
         bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
         textdomain (GETTEXT_PACKAGE);
         setlocale (LC_ALL, "");
@@ -125,8 +124,6 @@ main (int    argc,
 
         main_loop = g_main_loop_new (NULL, FALSE);
 
-        g_unix_signal_add (SIGTERM, on_shutdown_signal_cb, main_loop);
-        g_unix_signal_add (SIGINT, on_shutdown_signal_cb, main_loop);
         g_unix_signal_add (SIGUSR1, on_sigusr1_cb, NULL);
 
         g_main_loop_run (main_loop);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]