[X2Go-Commits] [x2goclient] 17/47: unixhelper.cpp: kill process group on error.

git-admin at x2go.org git-admin at x2go.org
Thu Jun 4 01:46:30 CEST 2015


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

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

commit c3157b977fdcd55d6004cf3b62d2fd92bde82a13
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Mon Mar 16 22:15:58 2015 +0100

    unixhelper.cpp: kill process group on error.
---
 debian/changelog   |    1 +
 src/unixhelper.cpp |   10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 24e73b8..e670945 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -68,6 +68,7 @@ x2goclient (4.0.4.1-0x2go1) UNRELEASED; urgency=low
       (module) namespace, not a class.
     - unixhelper.{cpp,h}: add documentation/comments.
     - x2goclient.cpp: return return value of unixhelper::unix_cleanup().
+    - unixhelper.cpp: kill process group on error.
 
  -- X2Go Release Manager <git-admin at x2go.org>  Tue, 26 May 2015 21:42:09 +0200
 
diff --git a/src/unixhelper.cpp b/src/unixhelper.cpp
index 2ad0740..d9ef3d7 100644
--- a/src/unixhelper.cpp
+++ b/src/unixhelper.cpp
@@ -28,13 +28,17 @@
 #include <iostream>
 #include <cstring>
 #include <cerrno>
-#include <cstdlib>
 
 /* For documentation please see unixhelper.h. */
 
 namespace unixhelper {
   void kill_pgroup (int signal) {
-    if (SIGHUP == signal) {
+    if ((SIGHUP == signal) || (-1 == signal)) {
+      if (-1 == signal) {
+        std::cerr << "ERROR: emergency exit due to previous error(s)." << "\n";
+        std::cerr << "Please report a bug, refer to this documentation: http://wiki.x2go.org/doku.php/wiki:bugs" << std::endl;
+      }
+
       /* Try to kill via SIGTERM first. */
       if (0 != killpg (getpgrp (), SIGTERM)) {
         std::cerr << "WARNING: unable to send SIGTERM to process group: " << std::strerror (errno) << std::endl;
@@ -52,7 +56,7 @@ namespace unixhelper {
   int unix_cleanup () {
     if (SIG_ERR == std::signal (SIGTERM, SIG_IGN)) {
       std::cerr << "Unable to ignore SIGTERM: " << std::strerror (errno) << std::endl;
-      std::exit (1);
+      kill_pgroup (-1);
 
       /* Anything here shall be unreachable. */
     }

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list