From 78b606fc408f447d9fa1de9fe68c013e53fbbbf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Lepp=C3=A4nen?= Date: Mon, 29 Jun 2020 16:31:09 +0300 Subject: [PATCH] [qtbase] Skip rootfs in QStorageInfo. Contributes to JB#50211 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Skips rootfs device since there is another device for /. It may exist because / has been pivot from rootfs to ext4 on boot but it's typically not useful. This allows another device mounted to the same mount point to overwrite rootfs device. Signed-off-by: Tomi Leppänen --- src/corelib/io/qstorageinfo_unix.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index c02d82a711..c165a3729d 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -459,7 +459,10 @@ 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.length()) { + if (isParentOf(mountDir, oldRootPath) + && (maxLength < mountDir.length() + // Alternative device that's not rootfs, overwrites pivoted root + || (rootPath == mountDir && device == "rootfs"))) { maxLength = mountDir.length(); rootPath = mountDir; device = it.device();