[X2Go-Commits] [x2goclient] 11/276: unixhelper.{cpp, h}, x2goclient.cpp}: unixhelper should really be a (module) namespace, not a class.
git-admin at x2go.org
git-admin at x2go.org
Sat Dec 31 01:34:14 CET 2016
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch bugfix/osx
in repository x2goclient.
commit af81f562ab255c36602c0475e3bece8e30dd6513
Author: Mihai Moldovan <ionic at ionic.de>
Date: Mon Mar 16 21:38:10 2015 +0100
unixhelper.{cpp,h},x2goclient.cpp}: unixhelper should really be a (module) namespace, not a class.
---
debian/changelog | 2 ++
src/unixhelper.cpp | 43 ++++++++++++++++++++++---------------------
src/unixhelper.h | 14 ++++----------
src/x2goclient.cpp | 3 +--
4 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 0a056e8..201c1a9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -31,6 +31,8 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
- unixhelper.{h,cpp}: also include <QtCore/qglobal.h> to have Q_OS_UNIX
defined on UNIX-based platforms. Move guards around.
- unixhelper.h: forgot to declare type of unix_cleanup() function.
+ - {unixhelper.{cpp,h},x2goclient.cpp}: unixhelper should really be a
+ (module) namespace, not a class.
[ Bernard Cafarelli ]
* New upstream version (4.0.5.3):
diff --git a/src/unixhelper.cpp b/src/unixhelper.cpp
index b326f35..b0729c6 100644
--- a/src/unixhelper.cpp
+++ b/src/unixhelper.cpp
@@ -30,34 +30,35 @@
#include <cerrno>
#include <cstdlib>
+namespace unixhelper {
+ void kill_pgroup (int signal) {
+ if (SIGHUP == signal) {
+ /* 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;
+ }
-void unixhelper::kill_pgroup (int signal) {
- if (SIGHUP == signal) {
- /* 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;
- }
-
- /* Grant a grace period of (at least) 5 seconds. */
- sleep (5);
+ /* Grant a grace period of (at least) 5 seconds. */
+ sleep (5);
- /* Don't handle any errors here, because we die anyway. */
- killpg (getpgrp (), SIGKILL);
+ /* Don't handle any errors here, because we die anyway. */
+ killpg (getpgrp (), SIGKILL);
+ }
}
-}
-int unixhelper::unix_cleanup () {
- if (SIG_ERR == std::signal (SIGTERM, SIG_IGN)) {
- std::cerr << "Unable to ignore SIGTERM: " << std::strerror (errno) << std::endl;
- std::exit (1);
- }
+ 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);
+ }
- std::signal (SIGHUP, kill_pgroup);
+ std::signal (SIGHUP, kill_pgroup);
- /* Sleep forever... at least one second in each run. */
- for (;;) {
- sleep (1);
+ /* Sleep forever... at least one second in each run. */
+ for (;;) {
+ sleep (1);
+ }
}
}
diff --git a/src/unixhelper.h b/src/unixhelper.h
index 9069b5d..fe86017 100644
--- a/src/unixhelper.h
+++ b/src/unixhelper.h
@@ -25,16 +25,10 @@
#ifdef Q_OS_UNIX
-class unixhelper {
- public:
- unixhelper () {}
- ~unixhelper () {}
- int unix_cleanup ();
-
- private:
- unixhelper (const unixhelper &other);
- void kill_pgroup (int signal);
-};
+namespace unixhelper {
+ int unix_cleanup ();
+ void kill_pgroup (int signal);
+}
#endif /* defined (Q_OS_UNIX) */
diff --git a/src/x2goclient.cpp b/src/x2goclient.cpp
index f495796..7eb6511 100644
--- a/src/x2goclient.cpp
+++ b/src/x2goclient.cpp
@@ -38,8 +38,7 @@ int fork_helper (int argc, char **argv) {
/* Child. */
if (0 == tmp_pid) {
/* Starting unixhelper. */
- unixhelper cleanup_helper ();
- cleanup_helper.unix_cleanup ();
+ unixhelper::unix_cleanup ();
}
/* Error. */
else if (-1 == tmp_pid) {
--
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