[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/solid/solid/backends/hal
From:       Kevin Ottens <ervin () kde ! org>
Date:       2009-10-27 19:09:31
Message-ID: 1256670571.459920.31511.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1041302 by ervin:

Don't try to resolve symlinks, etc. on mountpoints which might be
network mounts.


 M  +26 -9     halfstabhandling.cpp  


--- trunk/KDE/kdelibs/solid/solid/backends/hal/halfstabhandling.cpp #1041301:1041302
@@ -56,6 +56,19 @@
     return resolved;
 }
 
+bool _k_isNetworkFileSystem(const QString &fstype, const QString &devName)
+{
+    if (fstype == "nfs"
+     || fstype == "nfs4"
+     || fstype == "smbfs"
+     || fstype == "cifs"
+     || devName.startsWith("//")) {
+        return true;
+    }
+    return false;
+}
+
+
 void _k_updateMountPointsCache()
 {
     static bool firstCall = true;
@@ -81,10 +94,12 @@
 
     struct mntent *fe;
     while ((fe = getmntent(fstab)) != 0) {
-        const QString device = _k_resolveSymLink(QFile::decodeName(fe->mnt_fsname));
-        const QString mountpoint = _k_resolveSymLink(QFile::decodeName(fe->mnt_dir));
+        if (!_k_isNetworkFileSystem(fe->mnt_type, fe->mnt_fsname)) {
+            const QString device = _k_resolveSymLink(QFile::decodeName(fe->mnt_fsname));
+            const QString mountpoint = _k_resolveSymLink(QFile::decodeName(fe->mnt_dir));
 
-        globalMountPointsCache->insert(device, mountpoint);
+            globalMountPointsCache->insert(device, mountpoint);
+        }
     }
 
     endmntent(fstab);
@@ -117,14 +132,16 @@
             continue;
         }
 #endif
+        //prevent accessing a blocking directory
+        if (!_k_isNetworkFileSystem(items.at(2), items.at(0))) {
+            const QString device = _k_resolveSymLink(items.at(0));
+            const QString mountpoint = _k_resolveSymLink(items.at(1));
 
-        const QString device = _k_resolveSymLink(items.at(0));
-        const QString mountpoint = _k_resolveSymLink(items.at(1));
+            globalMountPointsCache->insert(device, mountpoint);
+        }
+    }
 
-        globalMountPointsCache->insert(device, mountpoint);
-   }
-
-   fstab.close();
+    fstab.close();
 #endif
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic