mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-16 11:26:11 -04:00
parent
577609b3e3
commit
154f1673e9
@ -46,6 +46,12 @@
|
||||
#include <QFileInfo>
|
||||
#include <QTemporaryFile>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
QSaveFilePrivate::QSaveFilePrivate()
|
||||
: tempFile(0), error(QFile::NoError)
|
||||
{
|
||||
@ -283,7 +289,15 @@ bool QSaveFile::commit()
|
||||
qWarning("QSaveFile::commit: File (%s) is not open", qPrintable(fileName()));
|
||||
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) {
|
||||
d->tempFile->remove();
|
||||
unsetError();
|
||||
|
Loading…
x
Reference in New Issue
Block a user