aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-07-30 17:30:00 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-30 17:30:00 +0200
commit138b58514c092e91c5609539aabffde1fe1d5d19 (patch)
tree2c3958559819a855166d2b242a01c53ff41c7a48
parentb3c06357a53ea35407abdf227f8fbeaaa72d7110 (diff)
Use proper error code for reading file
-rw-r--r--src/std/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/std/file.c b/src/std/file.c
index f0d769e..4542aba 100644
--- a/src/std/file.c
+++ b/src/std/file.c
@@ -199,7 +199,7 @@ int read_whole_file(const char *filepath, Buffer *data_result) {
result = fseek(file, 0, SEEK_SET);
if(result != 0) {
- result = ferror(file);
+ result = -1;
goto cleanup;
}
@@ -213,7 +213,7 @@ int read_whole_file(const char *filepath, Buffer *data_result) {
cleanup_if_error(buffer_append_empty(data_result, size));
bytes_read = fread(data_result->data, 1, data_result->size, file);
if(bytes_read != (unsigned long)size)
- result = ferror(file);
+ result = -1;
cleanup:
fclose(file);