Call OS functions to really flush the database to disk
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@283 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
c6fbc412be
commit
a2efb4f3b0
|
@ -1464,7 +1464,8 @@ bool Kdb3Database::save(){
|
||||||
error=decodeFileError(File->error());
|
error=decodeFileError(File->error());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
File->flush();
|
if (!syncFile(File))
|
||||||
|
qWarning("Unable to flush file to disk");
|
||||||
|
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
//if(SearchGroupID!=-1)Groups.push_back(SearchGroup);
|
//if(SearchGroupID!=-1)Groups.push_back(SearchGroup);
|
||||||
|
|
|
@ -24,8 +24,10 @@
|
||||||
|
|
||||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <unistd.h>
|
||||||
#elif defined(Q_WS_WIN)
|
#elif defined(Q_WS_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,int Width){
|
void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,int Width){
|
||||||
|
@ -236,6 +238,18 @@ bool unlockPage(void* addr, int len){
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool syncFile(QFile* file) {
|
||||||
|
if (!file->flush())
|
||||||
|
return false;
|
||||||
|
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
||||||
|
return (fsync(file->handle())==0);
|
||||||
|
#elif defined(Q_WS_WIN)
|
||||||
|
return (_commit(file->handle())==0);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
QTranslator* translator = new QTranslator();
|
QTranslator* translator = new QTranslator();
|
||||||
QTranslator* qtTranslator = new QTranslator();
|
QTranslator* qtTranslator = new QTranslator();
|
||||||
bool translatorActive = false;
|
bool translatorActive = false;
|
||||||
|
|
|
@ -30,9 +30,7 @@ struct Translation {
|
||||||
};
|
};
|
||||||
bool operator<(const Translation& t1, const Translation& t2);
|
bool operator<(const Translation& t1, const Translation& t2);
|
||||||
|
|
||||||
inline const char* CSTR(const QString& str) {
|
#define CSTR(x)(QTextCodec::codecForLocale()->fromUnicode(x).constData())
|
||||||
return QTextCodec::codecForLocale()->fromUnicode(str).constData();
|
|
||||||
}
|
|
||||||
|
|
||||||
const QIcon& getIcon(const QString& name);
|
const QIcon& getIcon(const QString& name);
|
||||||
const QPixmap* getPixmap(const QString& name);
|
const QPixmap* getPixmap(const QString& name);
|
||||||
|
@ -48,6 +46,7 @@ QString getImageFile(const QString& name);
|
||||||
bool createKeyFile(const QString& filename,QString* err, int length=32, bool Hex=true);
|
bool createKeyFile(const QString& filename,QString* err, int length=32, bool Hex=true);
|
||||||
bool lockPage(void* addr, int len);
|
bool lockPage(void* addr, int len);
|
||||||
bool unlockPage(void* addr, int len);
|
bool unlockPage(void* addr, int len);
|
||||||
|
bool syncFile(QFile* file);
|
||||||
void installTranslator();
|
void installTranslator();
|
||||||
bool isTranslationActive();
|
bool isTranslationActive();
|
||||||
QList<Translation> getAllTranslations();
|
QList<Translation> getAllTranslations();
|
||||||
|
|
Loading…
Reference in New Issue