aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authoronelin <oscar@nelin.dk>2026-09-05 13:29:19 +0000
committeronelin <oscar@nelin.dk>2026-09-05 13:29:19 +0000
commit4e144cb01db8170db76be6351aaf170500cacbad (patch)
tree55e1a59ea6a9cd86dbedeaa77d0679bdc1273f61 /main.c
parent2027db0a980fd179537bbce2cef6f29a57929c4b (diff)
Distinguish between EOF and read error
Diffstat (limited to 'main.c')
-rw-r--r--main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main.c b/main.c
index 616bd80..92603f2 100644
--- a/main.c
+++ b/main.c
@@ -123,7 +123,7 @@ f_read(FILE* stream, char** dst) {
bytes_read = fread(*dst, sizeof(char), file_sz, stream);
}
- if (bytes_read < file_sz) {
+ if (bytes_read < file_sz && feof(stream)) {
fprintf(stderr, "! Failed to read file, read %ld out of %ld bytes\n",
bytes_read, file_sz);
}