This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit 4bd7e5f7b0ce3795d6e755a37be98fde5fe14bf5
Author: Mihai Moldovan <io...@ionic.de>
Date:   Wed Mar 18 22:22:27 2015 +0100

    unixhelper.{cpp,h}: ignore SIGINT, SIGTERM, SIGPIPE, SIGQUIT, SIGUSR1 and 
SIGUSR2.
---
 debian/changelog   |    2 ++
 src/unixhelper.cpp |   18 +++++++++++++-----
 src/unixhelper.h   |    3 +++
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0492b55..36e6eed 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -51,6 +51,8 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
       to 10 seconds.
     - {unixhelper.{cpp,h},x2goclient.cpp}: switch main cleanup handling to
       parent PID polling.
+    - unixhelper.{cpp,h}: ignore SIGINT, SIGTERM, SIGPIPE, SIGQUIT, SIGUSR1
+      and SIGUSR2.
 
  -- X2Go Release Manager <git-ad...@x2go.org>  Mon, 19 Sep 2016 09:07:07 +0200
 
diff --git a/src/unixhelper.cpp b/src/unixhelper.cpp
index 410c320..acdee33 100644
--- a/src/unixhelper.cpp
+++ b/src/unixhelper.cpp
@@ -28,7 +28,7 @@
 #include <iostream>
 #include <cstring>
 #include <cerrno>
-#include <cstdlib>
+#include <vector>
 
 /* For documentation please see unixhelper.h. */
 
@@ -69,15 +69,23 @@ namespace unixhelper {
       /* Anything here shall be unreachable. */
     }
 
-    {
+    std::vector<int> ignore_signals;
+    ignore_signals.push_back (SIGINT);
+    ignore_signals.push_back (SIGTERM);
+    ignore_signals.push_back (SIGPIPE);
+    ignore_signals.push_back (SIGQUIT);
+    ignore_signals.push_back (SIGUSR1);
+    ignore_signals.push_back (SIGUSR2);
+
+    for (std::vector<int>::iterator it = ignore_signals.begin (); it != 
ignore_signals.end (); ++it) {
       struct sigaction sig_action;
       sig_action.sa_handler = SIG_IGN;
       sig_action.sa_mask = empty_set;
       sig_action.sa_flags = SA_RESTART;
 
-      /* Set up signal handler to ignore SIGTERM. */
-      if (0 != sigaction (SIGTERM, &sig_action, NULL)) {
-        std::cerr << "Unable to ignore SIGTERM: " << std::strerror (errno) << 
std::endl;
+      /* Set up signal handler to ignore the current signal. */
+      if (0 != sigaction (*it, &sig_action, NULL)) {
+        std::cerr << "Unable to ignore signal " << strsignal (*it) << ": " << 
std::strerror (errno) << std::endl;
         kill_pgroup (-1);
 
         /* Anything here shall be unreachable. */
diff --git a/src/unixhelper.h b/src/unixhelper.h
index 7511d4d..a34456e 100644
--- a/src/unixhelper.h
+++ b/src/unixhelper.h
@@ -35,6 +35,9 @@ namespace unixhelper {
    * an emergency exit is performed and
    * the whole process group killed.
    *
+   * The signals SIGINT, SIGTERM, SIGPIPE, SIGQUIT, SIGUSR1 and
+   * SIGUSR2 are ignored.
+   *
    * Loops indefinitely afterwards.
    *
    * In this loop, the current parent PID is polled and compared against

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email 
on /srv/git/code.x2go.org/x2goclient.git
_______________________________________________
x2go-commits mailing list
x2go-commits@lists.x2go.org
http://lists.x2go.org/listinfo/x2go-commits

Reply via email to