summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2017-01-27 11:10:03 +1300
committerRobert Ancell <robert.ancell@canonical.com>2017-01-27 11:10:03 +1300
commit680584676e3fb127c69a276eaa0913f55f87020e (patch)
tree6861969aec488aa6c8e6d91c5649e0ada53fab5f
parentefe8c45a10406d5f8255834ff84153be168cd8bb (diff)
downloadlightdm-git-680584676e3fb127c69a276eaa0913f55f87020e.tar.gz
Ignore SIGHUP by default and use SA_RESTART with SIGPIPE
-rw-r--r--src/lightdm.c7
-rw-r--r--src/process.c1
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lightdm.c b/src/lightdm.c
index 491b01a4..4b298bcf 100644
--- a/src/lightdm.c
+++ b/src/lightdm.c
@@ -597,6 +597,7 @@ login1_service_seat_removed_cb (Login1Service *service, Login1Seat *login1_seat)
int
main (int argc, char **argv)
{
+ struct sigaction action;
FILE *pid_file;
GOptionContext *option_context;
gboolean result;
@@ -648,7 +649,11 @@ main (int argc, char **argv)
* We will handle piples / sockets being closed instead of having the whole daemon be killed...
* http://stackoverflow.com/questions/8369506/why-does-sigpipe-exist
*/
- signal (SIGPIPE, SIG_IGN);
+ action.sa_handler = SIG_IGN;
+ sigemptyset (&action.sa_mask);
+ action.sa_flags = SA_RESTART;
+ sigaction (SIGPIPE, &action, NULL);
+ sigaction (SIGHUP, &action, NULL);
/* When lightdm starts sessions it needs to run itself in a new mode */
if (argc >= 2 && strcmp (argv[1], "--session-child") == 0)
diff --git a/src/process.c b/src/process.c
index 6f07e4e5..4815e460 100644
--- a/src/process.c
+++ b/src/process.c
@@ -461,7 +461,6 @@ process_class_init (ProcessClass *klass)
action.sa_flags = SA_SIGINFO | SA_RESTART;
sigaction (SIGTERM, &action, NULL);
sigaction (SIGINT, &action, NULL);
- sigaction (SIGHUP, &action, NULL);
sigaction (SIGUSR1, &action, NULL);
sigaction (SIGUSR2, &action, NULL);
}