summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qstorageinfo_unix.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-09-22 10:45:41 -0700
committerThiago Macieira <thiago.macieira@intel.com>2023-09-29 19:55:48 +0000
commit94df3f8d6bfb40c9339256a93e47a495caff152c (patch)
tree5155626cce41139f6625b3b900e68e8d34737f0a /src/corelib/io/qstorageinfo_unix.cpp
parentda95ad91b3602a6c60c62948ffb33e3399571a59 (diff)
QStorageInfo/Unix: check the mount point length before isParentOf()
Execute the cheaper test first, so we loop over the entries more quickly. Pick-to: 6.6 Change-Id: I9d43e5b91eb142d6945cfffd178749a12c966739 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qstorageinfo_unix.cpp')
-rw-r--r--src/corelib/io/qstorageinfo_unix.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp
index 3c80c31453..af65823b1d 100644
--- a/src/corelib/io/qstorageinfo_unix.cpp
+++ b/src/corelib/io/qstorageinfo_unix.cpp
@@ -449,7 +449,7 @@ void QStorageInfoPrivate::initRootPath()
const QString mountDir = it.rootPath();
const QByteArray fsName = it.fileSystemType();
// we try to find most suitable entry
- if (isParentOf(mountDir, oldRootPath) && maxLength < mountDir.size()) {
+ if (maxLength < mountDir.size() && isParentOf(mountDir, oldRootPath)) {
maxLength = mountDir.size();
rootPath = mountDir;
device = it.device();