Provide fallback if resize fails (hopefully fixes gvfs errors)

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@330 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 16 years ago
parent 0a2733a992
commit 8f5cf14b30
  1. 4
      src/Kdb3Database.cpp

@ -1456,10 +1456,14 @@ bool Kdb3Database::save(){
int size = EncryptedPartSize+DB_HEADER_SIZE;
if (!File->resize(size)){
if (File->size() > size) {
if (!File->remove() || !File->open(QIODevice::ReadWrite)) {
delete [] buffer;
error=decodeFileError(File->error());
return false;
}
}
}
File->seek(0);
if (File->write(buffer,size)!=size){
delete [] buffer;