summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorVasily Khoruzhick <vasilykh@arista.com>2015-09-23 13:50:13 -0700
committerRay Strode <rstrode@redhat.com>2016-01-21 15:35:20 -0500
commit6b8586958a97c0a72b9c8bae3c73b945089dfa3d (patch)
treef6e5170873f17224800e61c934eea43a4ba0c48b /daemon
parentc4292870f0e19e48b484081d815bc9ff66061e23 (diff)
downloadgdm-6b8586958a97c0a72b9c8bae3c73b945089dfa3d.tar.gz
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
Diffstat (limited to 'daemon')
-rw-r--r--daemon/session-worker-main.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/daemon/session-worker-main.c b/daemon/session-worker-main.c
index ede60c59..051d7f97 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);