[X2Go-Commits] [x2goclient] 04/44: x2goclient.cpp: add fork_helper() function to start up the UNIX cleanup helper.
git-admin at x2go.org
git-admin at x2go.org
Mon Jun 29 23:02:03 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 b238852556f2324d8683e85a2d6d11837305b751
Author: Mihai Moldovan <ionic at 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 096407d..b164ea7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -66,6 +66,8 @@ x2goclient (4.0.4.1-0x2go1) UNRELEASED; urgency=low
- {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.
[ Mike Gabriel ]
* debian/control:
diff --git a/src/x2goclient.cpp b/src/x2goclient.cpp
index 80fd967..f285f40 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
More information about the x2go-commits
mailing list