Only flush file handles on close if they were opened for writing.
(transplanted from 89e1b79e10c6e9faf9e4c06dc357dee5ef2c7d4f)
This commit is contained in:
parent
9a825fcd77
commit
fa34bb479d
13
src/physfs.c
13
src/physfs.c
|
@ -2678,12 +2678,15 @@ static int closeHandleInOpenList(FileHandle **list, FileHandle *handle)
|
|||
PHYSFS_uint8 *tmp = handle->buffer;
|
||||
|
||||
/* send our buffer to io... */
|
||||
if (!PHYSFS_flush((PHYSFS_File *) handle))
|
||||
return -1;
|
||||
if (!handle->forReading)
|
||||
{
|
||||
if (!PHYSFS_flush((PHYSFS_File *) handle))
|
||||
return -1;
|
||||
|
||||
/* ...then have io send it to the disk... */
|
||||
else if (io->flush && !io->flush(io))
|
||||
return -1;
|
||||
/* ...then have io send it to the disk... */
|
||||
else if (io->flush && !io->flush(io))
|
||||
return -1;
|
||||
} /* if */
|
||||
|
||||
/* ...then close the underlying file. */
|
||||
io->destroy(io);
|
||||
|
|
Loading…
Reference in New Issue