soliduiserver: store the filesystem match string outside the loop

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-05-07 16:58:36 +03:00
parent 4f1ae2af3f
commit 9e4c84f8e6

View file

@ -120,9 +120,10 @@ KAuth::ActionReply SolidUiServerHelper::mount(const QVariantMap &parameters)
const QByteArray fstypebytes = fstype.toLocal8Bit();
QFile filesystemsfile(QString::fromLatin1("/proc/filesystems"));
if (filesystemsfile.open(QFile::ReadOnly)) {
const QByteArray filesystemmatch = QByteArray(" ") + fstypebytes;
while (!filesystemsfile.atEnd()) {
const QByteArray filesystemsline = filesystemsfile.readLine().trimmed();
if (filesystemsline.endsWith(QByteArray(" ") + fstypebytes)) {
if (filesystemsline.endsWith(filesystemmatch)) {
isknownfs = true;
break;
}