From 02dd68b3852fdfaefb52cfff314a2d48a5d77fd5 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Fri, 3 Feb 2023 17:05:11 +0100 Subject: [PATCH] processing exit value of why2_check_version's fread removing all TODOs --- src/core/lib/utils/misc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/lib/utils/misc.c b/src/core/lib/utils/misc.c index 3f0984d..5c497cf 100644 --- a/src/core/lib/utils/misc.c +++ b/src/core/lib/utils/misc.c @@ -145,7 +145,13 @@ enum WHY2_EXIT_CODES why2_check_version(void) buffer = why2_calloc(bufferSize + 1, sizeof(char)); //LOAD jsonFile - (void) (fread(buffer, bufferSize, 1, fileBuffer) + 1); //TODO: Try to create some function for processing exit value + if (fread(buffer, bufferSize, 1, fileBuffer) != 1) + { + if (!why2_get_flags().no_output) fprintf(stderr, "Reading file failed!\n"); + + why2_clean_memory("core_version_check"); + return WHY2_DOWNLOAD_FAILED; + } buffer[bufferSize] = '\0';