diff options
| author | onelin <oscar@nelin.dk> | 2026-09-05 13:29:19 +0000 |
|---|---|---|
| committer | onelin <oscar@nelin.dk> | 2026-09-05 13:29:19 +0000 |
| commit | 4e144cb01db8170db76be6351aaf170500cacbad (patch) | |
| tree | 55e1a59ea6a9cd86dbedeaa77d0679bdc1273f61 | |
| parent | 2027db0a980fd179537bbce2cef6f29a57929c4b (diff) | |
Distinguish between EOF and read error
| -rw-r--r-- | main.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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); } |
