mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-09-19 12:24:41 -04:00
parent
577609b3e3
commit
154f1673e9
1 changed files with 15 additions and 1 deletions
|
@ -46,6 +46,12 @@
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
# include <windows.h>
|
||||||
|
#else
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
QSaveFilePrivate::QSaveFilePrivate()
|
QSaveFilePrivate::QSaveFilePrivate()
|
||||||
: tempFile(0), error(QFile::NoError)
|
: tempFile(0), error(QFile::NoError)
|
||||||
{
|
{
|
||||||
|
@ -283,7 +289,15 @@ bool QSaveFile::commit()
|
||||||
qWarning("QSaveFile::commit: File (%s) is not open", qPrintable(fileName()));
|
qWarning("QSaveFile::commit: File (%s) is not open", qPrintable(fileName()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QIODevice::close(); // flush and close
|
flush();
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
FlushFileBuffers(reinterpret_cast<HANDLE>(handle()));
|
||||||
|
#elif defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
|
||||||
|
fdatasync(d->tempFile->handle());
|
||||||
|
#else
|
||||||
|
fsync(d->tempFile->handle());
|
||||||
|
#endif
|
||||||
|
QIODevice::close();
|
||||||
if (d->error != QFile::NoError) {
|
if (d->error != QFile::NoError) {
|
||||||
d->tempFile->remove();
|
d->tempFile->remove();
|
||||||
unsetError();
|
unsetError();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue