From 138b58514c092e91c5609539aabffde1fe1d5d19 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 30 Jul 2020 17:30:00 +0200 Subject: Use proper error code for reading file --- src/std/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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); -- cgit v1.2.3