Skip to content

Commit

Permalink
check for EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
xdsopl committed Jun 5, 2024
1 parent 3547e1b commit 64f0168
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions bytes.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ int put_byte(struct bytes_writer *bytes, int b)
{
if (bytes->cap > 0 && bytes->cnt >= bytes->cap)
return -2;
b &= 255;
if (b != fputc(b, bytes->file)) {
if (EOF == fputc(b & 255, bytes->file)) {
fprintf(stderr, "could not write to file \"%s\"\n", bytes->name);
return -1;
}
Expand Down

0 comments on commit 64f0168

Please sign in to comment.