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

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

commit 51a592b6e11171c309a70bed30dbf516c65f82ac
Author: Mihai Moldovan <io...@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 cc1737b..2bb6db1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,6 +25,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.
 
  -- 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 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
_______________________________________________
x2go-commits mailing list
x2go-commits@lists.x2go.org
http://lists.x2go.org/listinfo/x2go-commits

Reply via email to