From kde-commits Tue Oct 27 19:09:31 2009 From: Kevin Ottens Date: Tue, 27 Oct 2009 19:09:31 +0000 To: kde-commits Subject: KDE/kdelibs/solid/solid/backends/hal Message-Id: <1256670571.459920.31511.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=125667057931417 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 }