fixed Localfile::write to truncate the file when zero data is written
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@116
This commit is contained in:
parent
5473800c32
commit
6931e8fa41
1 changed files with 7 additions and 2 deletions
|
@ -265,10 +265,15 @@ bool localFile::Read(Bit8u * data,Bit16u * size) {
|
|||
};
|
||||
|
||||
bool localFile::Write(Bit8u * data,Bit16u * size) {
|
||||
*size=fwrite(data,1,*size,fhandle);
|
||||
if(*size==0){
|
||||
return (!ftruncate(fileno(fhandle),ftell(fhandle)));
|
||||
}
|
||||
else
|
||||
{
|
||||
*size=fwrite(data,1,*size,fhandle);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool localFile::Seek(Bit32u * pos,Bit32u type) {
|
||||
int seektype;
|
||||
switch (type) {
|
||||
|
|
Loading…
Add table
Reference in a new issue