Skip to content

Commit

Permalink
Merge pull request tcarmelveilleux#3 from ratherlargerobot/fread-brk-…
Browse files Browse the repository at this point in the history
…bugfix

Use fread() return value to count bytes
  • Loading branch information
tcarmelveilleux authored Sep 2, 2018
2 parents c003395 + 8b01d8b commit 680c212
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dcc6502.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,8 @@ int main(int argc, char *argv[]) {

byte_count = 0;
while(!feof(input_file) && ((options.org + byte_count) <= 0xFFFFu) && (byte_count < options.max_num_bytes)) {
fread(&buffer[options.org + byte_count], 1, 1, input_file);
byte_count++;
size_t bytes_read = fread(&buffer[options.org + byte_count], 1, 1, input_file);
byte_count += bytes_read;
}

fclose(input_file);
Expand Down

0 comments on commit 680c212

Please sign in to comment.