mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-29 01:06:27 -05:00
Use copy instead of rename for unsafe saving on Linux
Resolves #1511 See https://bugreports.qt.io/browse/QTBUG-64008
This commit is contained in:
parent
395afe59eb
commit
4c8d426f23
@ -537,11 +537,19 @@ QString Database::saveToFile(QString filePath, bool atomic, bool backup)
|
||||
|
||||
// Delete the original db and move the temp file in place
|
||||
QFile::remove(filePath);
|
||||
#ifdef Q_OS_LINUX
|
||||
// workaround to make this workaround work, see: https://bugreports.qt.io/browse/QTBUG-64008
|
||||
if (tempFile.copy(filePath)) {
|
||||
// successfully saved database file
|
||||
return {};
|
||||
}
|
||||
#else
|
||||
if (tempFile.rename(filePath)) {
|
||||
// successfully saved database file
|
||||
tempFile.setAutoRemove(false);
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
}
|
||||
error = tempFile.errorString();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user