I think it's correct as it is. Quoting GNU libc manual: """If `fread' encounters end of file in the middle of an object, it returns the number of complete objects read, and discards the partial object."""