Merge branch 'develop' into '35-incorrect-struct-type-used-in-readwrite-c'

# Conflicts:
#   debian/changelog
This commit is contained in:
Patrick J Cherry
2018-02-09 11:29:48 +00:00
4 changed files with 33 additions and 0 deletions

View File

@@ -97,6 +97,15 @@ int open_and_mmap(const char* filename, int* out_fd, uint64_t *out_size, void **
warn("lseek64() failed");
return size;
}
/* If discs are not in multiples of 512, then odd things happen,
* resulting in reads/writes past the ends of files.
*/
if ( size != (size & (~0x1ff))) {
warn("file does not fit into 512-byte sectors; the end of the file will be ignored.");
size &= ~0x1ff;
}
if (out_size) {
*out_size = size;
}