[X2Go-Commits] [x2goclient] 19/138: x2goclient.cpp: fix compile problems introduced with the last commit.
git-admin at x2go.org
git-admin at x2go.org
Mon Jan 18 22:48:09 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 15af7bb79154edabe4fca9635642f4f7cafd577d
Author: Mihai Moldovan <ionic at ionic.de>
Date: Wed Mar 18 03:06:15 2015 +0100
x2goclient.cpp: fix compile problems introduced with the last commit.
---
debian/changelog | 1 +
src/x2goclient.cpp | 25 +++++++++++++++++--------
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index fd23b7d..8bb86e4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -57,6 +57,7 @@ x2goclient (4.0.5.1-0x2go1) UNRELEASED; urgency=low
re-execute the main binary with this new option to indicate that the
UNIX cleanup helper tool is requested. It is necessary to call exec()
after fork on virtually all operating system, especially on OS X.
+ - x2goclient.cpp: fix compile problems introduced with the last commit.
* debian/control:
- Change apache2-dev | libc6-dev build dependency back to apache2-dev
only. Otherwise, apache2-dev is not installed at all, even though
diff --git a/src/x2goclient.cpp b/src/x2goclient.cpp
index 3f11d55..895db0d 100644
--- a/src/x2goclient.cpp
+++ b/src/x2goclient.cpp
@@ -26,6 +26,7 @@
#include <algorithm>
#include <cctype>
#include <vector>
+#include <csignal>
#include "unixhelper.h"
#include "ongetpass.h"
@@ -43,16 +44,23 @@ int fork_helper (int argc, char **argv) {
if (0 == tmp_pid) {
/* Starting unixhelper. */
std::vector<std::string> new_argv;
- new_argv.push (std::string (argv[0]));
- new_argv.push ("--unixhelper");
+ new_argv.push_back (std::string (argv[0]));
+ new_argv.push_back ("--unixhelper");
- std::vector<const char *> new_argv_c_str;
- for (const_iterator it = new_argv.begin (); it != new_argv.end (); ++it) {
- new_argv_c_str.push ((*it).c_str ());
+ std::vector<char *> new_argv_c_str;
+ for (std::vector<std::string>::iterator it = new_argv.begin (); it != new_argv.end (); ++it) {
+ const char *elem = (*it).c_str ();
+ new_argv_c_str.push_back (strndup (elem, std::strlen (elem)));
}
- new_argv_c_str.push ("");
- if (0 != execv (new_argv_c_str.data (), new_argv_c_str.data ())) {
+ /* Add null pointer as last element. */
+ {
+ std::vector<char> tmp;
+ tmp.push_back (0);
+ new_argv_c_str.push_back (&tmp.front ());
+ }
+
+ if (0 != execv (new_argv_c_str.front (), &(new_argv_c_str.front ()))) {
std::cerr << "Failed to re-execute process as UNIX cleanup helper tool: " << std::strerror (errno) << "\n"
<< "Terminating and killing parent." << "\n"
<< "Please report a bug, refer to this documentation: http://wiki.x2go.org/doku.php/wiki:bugs" << std::endl;
@@ -66,6 +74,7 @@ int fork_helper (int argc, char **argv) {
}
/* Anything here shall be unreachable. */
+ return (0);
}
/* Error. */
else if (-1 == tmp_pid) {
@@ -90,7 +99,7 @@ int main (int argc, char **argv) {
std::string cur_arg (argv[i]);
/* Make the current argument lowercase. */
- std::transform (cur_arg.begin (), cur_arg.end (), cur_arg.begin (), std::tolower);
+ std::transform (cur_arg.begin (), cur_arg.end (), cur_arg.begin (), ::tolower);
if ((!cur_arg.empty ()) && (cur_arg.compare ("--unixhelper"))) {
unix_helper_request = 1;
--
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