[X2Go-Commits] [x2goclient] 03/03: src/x2goutils.cpp: fix add_to_path ().

git-admin at x2go.org git-admin at x2go.org
Fri Dec 9 18:51:53 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 1f778739e4604152b8c0b6a79d6ab2214f8c4974
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Fri Dec 9 18:51:15 2016 +0100

    src/x2goutils.cpp: fix add_to_path ().
    
    We want to remove trailing slashes from elements-to-add, not just fetch
    a trailing slash if encountered.
    
    Also, better don't compare a value from the original path value to
    itself, but rather to the things we want to add in order to remove
    duplicates, not remove most of the list of elements to add...
---
 debian/changelog  |    5 +++++
 src/x2goutils.cpp |    5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index bbd593b..d7738bd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -486,6 +486,11 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
     - src/onmainwindow.cpp: remove trailing slash from Mageia/SUSE/Arch
       sftp-server binary search path.
     - src/x2goutils.cpp: add debugging output to add_to_path ().
+    - src/x2goutils.cpp: fix add_to_path (). We want to remove trailing
+      slashes from elements-to-add, not just fetch a trailing slash if
+      encountered. Also, better don't compare a value from the original path
+      value to itself, but rather to the things we want to add in order to
+      remove duplicates, not remove most of the list of elements to add...
 
   [ Bernard Cafarelli ]
   * New upstream version (4.0.5.3):
diff --git a/src/x2goutils.cpp b/src/x2goutils.cpp
index f45e79f..acaeaf8 100644
--- a/src/x2goutils.cpp
+++ b/src/x2goutils.cpp
@@ -221,7 +221,8 @@ QString add_to_path (const QString &orig_path, const QStringList &add, const boo
   for (int i = 0; i < add.size (); ++i) {
     if (!(add[i].isEmpty ())) {
       if (add[i].right (1) == "/") {
-        QString tmp_elem = add[i].right (1);
+        QString tmp_elem = add[i];
+        tmp_elem.chop (1);
 
         if (!(tmp_elem.isEmpty ())) {
           tmp_clean_add.append (tmp_elem);
@@ -249,7 +250,7 @@ QString add_to_path (const QString &orig_path, const QStringList &add, const boo
       bool tmp_found = false;
 
       for (QStringList::const_iterator cit2 = cit + 1; cit2 != end; ++cit2) {
-        if (*cit == *cit) {
+        if (*cit == *cit2) {
           tmp_found = true;
           break;
         }

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