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

git-admin at x2go.org git-admin at x2go.org
Sat Dec 31 01:35:42 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 fb924620faf79eb3383b8834ed1dd7f2a7ba007f
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 e267f2c..8a355ed 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -490,6 +490,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 0a01b62..d076c74 100644
--- a/src/x2goutils.cpp
+++ b/src/x2goutils.cpp
@@ -226,7 +226,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);
@@ -254,7 +255,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