[X2Go-Commits] [x2goclient] 14/31: unixhelper.cpp: kill process group on error.
git-admin at x2go.org
git-admin at x2go.org
Wed Mar 25 21:42:15 CET 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 a68ab86a25be32b68f00ff7b5166b68790b14419
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 cd56157..c353217 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -265,6 +265,7 @@ x2goclient (4.0.4.0-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.
[ Fernando Pedemonte ]
* New upstream release (4.0.4.0):
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