Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > fd4cd2f7616f47ca9a62a573f59c142d > files > 24

kdelibs4-4.6.5-1.6.mga1.src.rpm

diff --git a/kdecore/config/kconfigini.cpp b/kdecore/config/kconfigini.cpp
index 5f7ba7c..718ad29 100644
--- a/kdecore/config/kconfigini.cpp
+++ b/kdecore/config/kconfigini.cpp
@@ -500,14 +500,18 @@ bool KConfigIniBackend::isWritable() const
         // The check might have failed because any of the containing dirs
         // did not exist. If the file does not exist, check if the deepest
         // existing dir is writable.
-        if (!QFileInfo(filePath()).exists()) {
-            QDir dir = QFileInfo(filePath()).absolutePath();
+        QFileInfo file(filePath());
+        if (!file.exists()) {
+            QFileInfo dir(file.absolutePath());
             while (!dir.exists()) {
-                if (!dir.cdUp()) {
+                QString parent = dir.absolutePath();
+                if (parent == dir.filePath()) {
+                    // no parent
                     return false;
                 }
+                dir.setFile(parent);
             }
-            return QFileInfo(dir.absolutePath()).isWritable();
+            return dir.isDir() && dir.isWritable();
         }
     }