[X2Go-Commits] [x2goclient] 19/217: x2goclient.cpp: fix compile problems introduced with the last commit.
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 4e49eaa64a13590f3ef57cca7c86ec914acb753b Author: Mihai Moldovan 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 025138c..7f40683 100644 --- a/debian/changelog +++ b/debian/changelog @@ -38,6 +38,7 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium 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. -- X2Go Release Manager Mon, 19 Sep 2016 09:07:07 +0200 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 #include #include +#include #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 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 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 new_argv_c_str; +for (std::vector::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 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 ___ x2go-commits mailing list x2go-commits@lists.x2go.org http://lists.x2go.org/listinfo/x2go-commits
[X2Go-Commits] [x2goclient] 19/217: x2goclient.cpp: fix compile problems introduced with the last commit.
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 85ee744ae941ae72b1ccabc7435d03aa6a67b25b Author: Mihai Moldovan 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 b5ea29e..d521737 100644 --- a/debian/changelog +++ b/debian/changelog @@ -71,6 +71,7 @@ x2goclient (4.0.5.2-0x2go1) UNRELEASED; urgency=medium 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: - Maintainer change in package: X2Go Developers . - Uploaders: add myself. Also, force a rebuild due to the changed 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 #include #include +#include #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 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 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 new_argv_c_str; +for (std::vector::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 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 ___ x2go-commits mailing list x2go-commits@lists.x2go.org http://lists.x2go.org/listinfo/x2go-commits