summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-09-22 20:04:11 -0700
committerThiago Macieira <thiago.macieira@intel.com>2023-10-16 08:41:21 -0700
commitcad7164ee24bb7b8b9ddf1ae8171a0098af7b0d7 (patch)
tree6529c85cc1ec3facebb665714a1f4d3223f2e2cc /src/corelib/io
parentdf8514a764a96b2dd571a2444573c2f0849abf4f (diff)
QStorageInfo/Linux: include QDir::Hidden in the search for labels
There's nothing wrong with device labels starting with a dot. Whether udev would encode those as \x2e is unknown, but we may as well not tempt fate in case it has changed or changes in the future. Also including QDir::System in case udev places the actual device nodes in /dev/disks/by-label instead of a symlink. As a nice and intentional side-effect, QDirIterator no longer performs a stat() in each of the entries, removing the double stat'ing that started happening with the previous commit. Pick-to: 6.6 Change-Id: I9d43e5b91eb142d6945cfffd1787681b4cf2bb58 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qstorageinfo_linux.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/io/qstorageinfo_linux.cpp b/src/corelib/io/qstorageinfo_linux.cpp
index 1a27ac060b..99143a5975 100644
--- a/src/corelib/io/qstorageinfo_linux.cpp
+++ b/src/corelib/io/qstorageinfo_linux.cpp
@@ -68,7 +68,8 @@ static inline QString retrieveLabel(const QByteArray &device)
if (devicePath.isEmpty())
return QString();
- QDirIterator it(QLatin1StringView(pathDiskByLabel), QDir::NoDotAndDotDot);
+ auto filter = QDir::AllEntries | QDir::System | QDir::Hidden | QDir::NoDotAndDotDot;
+ QDirIterator it(QLatin1StringView(pathDiskByLabel), filter);
while (it.hasNext()) {
QFileInfo fileInfo = it.nextFileInfo();
if (fileInfo.symLinkTarget() == devicePath)