| --- a/src/code_io.c |
| +++ b/src/code_io.c |
| @@ -203,9 +203,9 @@ extern file_buffer_ty * read_file( |
| * bytes in a 16-bit world... |
| */ |
| |
| - unsigned int size = 0, size_to_read = 0; |
| + unsigned int size = 0, size_to_read = 0, size_sum = 0; |
| #else |
| - ssize_t size = 0; |
| + ssize_t size = 0, size_sum = 0; |
| size_t size_to_read = 0; |
| #endif |
| |
| @@ -284,8 +284,12 @@ extern file_buffer_ty * read_file( |
| xfree(fileptr.data); |
| fatal (_("Error reading input file %s"), filename); |
| } |
| + if (size == 0) |
| + break; |
| size_to_read -= size; |
| + size_sum += size; |
| } |
| + size = size_sum; |
| |
| if (close(fd) < 0) |
| { |