Skip to content

Commit ff8df60

Browse files
itsXuStdeepin-bot[bot]
authored andcommitted
fix: [crypttab] new way to judge if device is encrypted.
if target device in crypttab is not existed in /dev/mapper then remove the item. Log: as title.
1 parent fbf9d2c commit ff8df60

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/dde-file-manager-daemon/daemonplugin-file-encrypt/dbus/diskencryptdbus.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ bool DiskEncryptDBus::updateCrypttab()
364364
if (isEncrypted(items.at(0), items.at(1)) == 0) {
365365
lines.removeAt(i);
366366
cryptUpdated = true;
367-
qInfo() << "==== [remove] this item is not encrypted:" << line;
367+
qWarning() << "==== [remove] this item is not encrypted:" << line;
368368
continue;
369369
}
370370

@@ -387,6 +387,8 @@ bool DiskEncryptDBus::updateCrypttab()
387387

388388
int DiskEncryptDBus::isEncrypted(const QString &target, const QString &source)
389389
{
390+
return QFile("/dev/mapper/" + target).exists() ? 1 : 0;
391+
390392
QMap<QString, QString> dev2uuid, uuid2dev, puuid2dev;
391393
getDeviceMapper(&dev2uuid, &uuid2dev, &puuid2dev);
392394

0 commit comments

Comments
 (0)