[SCM] Kaboom - Debian KDE 3->4 migration tool branch, master, updated. master/1.1.2-1-ga8411f3

Pino Toscano pino-guest at alioth.debian.org
Thu Dec 24 14:56:07 UTC 2009


The following commit has been merged in the master branch:
commit a8411f34cae933b99eb542e6adb6d8bd5f2e966d
Author: Pino Toscano <pino at kde.org>
Date:   Thu Dec 24 15:48:58 2009 +0100

    Make relativeSymLinkTarget() compiling on non-PATH_MAX OSes.
    
    For those OSes, a variable length buffer is used, intialised with the result
    of pathconf(_PC_PATH_MAX) for the path of the symlink to resolve
    (or 4096 if there is no limit).
    Should change nothing for OSes with PATH_MAX defined.
---
 debian/changelog                |    9 +++++++++
 diroperations/diroperations.cpp |   15 ++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1fe4d0c..b0bbdbb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+kaboom (1.1.3) UNRELEASED; urgency=low
+
+  +++ Changes by Pino Toscano:
+
+  * Make relativeSymLinkTarget() compiling (and hopefully working) also
+    on OSes without PATH_MAX defined (e.g. GNU/Hurd).
+
+ -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Thu, 24 Dec 2009 15:48:36 +0100
+
 kaboom (1.1.2) unstable; urgency=low
 
   +++ Changes by George Kiagiadakis:
diff --git a/diroperations/diroperations.cpp b/diroperations/diroperations.cpp
index b7abc03..a8dd9bf 100644
--- a/diroperations/diroperations.cpp
+++ b/diroperations/diroperations.cpp
@@ -19,6 +19,7 @@
 #include <QtCore/QFile>
 #include <QtCore/QDebug>
 #include <QtCore/QCoreApplication>
+#include <QtCore/QVarLengthArray>
 #include <climits> //for PATH_MAX
 #include <unistd.h> //for readlink()
 #define _FILE_OFFSET_BITS 64
@@ -44,8 +45,20 @@ QString bytesToString(quint64 bytes)
 
 QString relativeSymLinkTarget(const QString & fileName)
 {
+    const QByteArray encodedFileName = QFile::encodeName(fileName);
+#ifdef PATH_MAX
     char buff[PATH_MAX+1];
-    int len = ::readlink(QFile::encodeName(fileName), buff, PATH_MAX);
+    int buff_size = sizeof(buff);
+#else
+    int path_max = pathconf(encodedFileName.data(), _PC_PATH_MAX);
+    if (path_max <= 0) {
+        path_max = 4096;
+    }
+    QVarLengthArray<char, 4096> varbuff(path_max);
+    char *buff = varbuff.data();
+    int buff_size = varbuff.size();
+#endif
+    int len = ::readlink(encodedFileName.data(), buff, buff_size - 1);
     if ( len < 0 )
         return QString();
     buff[len] = '\0';

-- 
Kaboom - Debian KDE 3->4 migration tool



More information about the pkg-kde-commits mailing list