Improved check against number of bytes read

This commit is contained in:
Robert Osfield 2016-06-30 08:27:49 +01:00
parent fec64f6d8c
commit 9b1107eb64

View File

@ -172,7 +172,7 @@ load_md2 (const char *filename, const osgDB::ReaderWriter::Options* options)
return NULL; return NULL;
} }
if (read(file_fd, mapbase, st.st_size)==0) if (read(file_fd, mapbase, st.st_size) != st.st_size)
{ {
close (file_fd); close (file_fd);
if (mapbase) free(mapbase); if (mapbase) free(mapbase);