Skip to content

Commit

Permalink
[qtbase] Skip rootfs in QStorageInfo. Contributes to JB#50211
Browse files Browse the repository at this point in the history
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 <tomi.leppanen@jolla.com>
  • Loading branch information
Tomin1 committed Jun 30, 2020
1 parent d63a8c6 commit 78b606f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/corelib/io/qstorageinfo_unix.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit 78b606f

Please sign in to comment.