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

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

commit 76526756fab49b421cdeab3d632bffde358fed0f
Author: Mihai Moldovan <io...@ionic.de>
Date:   Mon Mar 16 20:27:23 2015 +0100

    x2goclient.cpp: add fork_helper() function to start up the UNIX cleanup 
helper.
---
 debian/changelog   |    2 ++
 src/x2goclient.cpp |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index bd51c62..a8b4d65 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,8 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
     - {unixhelper.{cpp,h},x2goclient.pro{,.maemo}}: add unixhelper stub.
     - unixhelper.{cpp,h}: implement cleanup program for process group.
     - x2goclient.cpp: wrap X2Go Client main function and use that.
+    - x2goclient.cpp: add fork_helper() function to start up the UNIX cleanup
+      helper.
 
   [ Bernard Cafarelli ]
   * New upstream version (4.0.5.3):
diff --git a/src/x2goclient.cpp b/src/x2goclient.cpp
index fb63fe5..df15858 100644
--- a/src/x2goclient.cpp
+++ b/src/x2goclient.cpp
@@ -15,12 +15,45 @@
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
 ***************************************************************************/
 
+#include <iostream>
+#include <unistd.h>
+#include <cstring>
+#include <cerrno>
+#include <cstdlib>
+
+#include "unixhelper.h"
 #include "ongetpass.h"
 
 int wrap_x2go_main (int argc, char **argv) {
   return (x2goMain (argc, argv));
 }
 
+#ifdef Q_OS_UNIX
+int fork_helper (int argc, char **argv) {
+  /* Fork off to start helper process. */
+  pid_t tmp_pid = fork ();
+
+  /* Child. */
+  if (0 == tmp_pid) {
+    /* Starting unixhelper. */
+    unixhelper cleanup_helper ();
+    cleanup_helper.unix_cleanup ();
+  }
+  /* Error. */
+  else if (-1 == tmp_pid) {
+    std::cerr << "Unable to create a new process for the UNIX cleanup 
watchdog: " << std::strerror (errno) << "\n";
+    std::cerr << "Terminating. Please report a bug, refer to this 
documentation: http://wiki.x2go.org/doku.php/wiki:bugs"; << std::endl;
+
+    std::exit (EXIT_FAILURE);
+  }
+  /* Parent. */
+  else {
+    /* Start real X2Go Client. */
+    return (wrap_x2go_main (argc, argv));
+  }
+}
+#endif /* defined (Q_OS_UNIX) */
+
 int main(int argc, char *argv[])
 {
        return (wrap_x2go_main (argc, argv));

--
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