When overwriting an index.txt file, truncate it.

This commit is contained in:
Christian Hohnstaedt 2018-04-09 05:21:22 +02:00
parent cd118e4e72
commit e95198e775

View File

@ -761,7 +761,7 @@ void db_x509::store(QModelIndexList list)
void db_x509::writeIndex(const QString fname, QList<pki_x509*> items)
{
QFile file(fname);
file.open(QFile::ReadWrite);
file.open(QFile::ReadWrite | QFile::Truncate);
if (file.error()) {
throw errorEx(tr("Error opening file: '%1': %2")
.arg(fname).arg(strerror(errno)));