From f8eb78b14cb12b8e8842276c03130694675bdc1e Mon Sep 17 00:00:00 2001 From: kaotisk Date: Tue, 4 Jun 2024 03:39:36 +0300 Subject: Forgot to exit in case of fopen error and check also on the second call --- src/tests/test_akfs.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/tests/test_akfs.c b/src/tests/test_akfs.c index e95508b..c1eddbc 100644 --- a/src/tests/test_akfs.c +++ b/src/tests/test_akfs.c @@ -152,12 +152,18 @@ void hash_save_to_file() if ( fd == NULL ) { printf("Some error occured"); + exit(1); } fwrite(&resulted_hash, sizeof(sha512sum),1,fd); fclose(fd); sha512sum readone = {0}; fd = fopen("tmpfile", "rb"); + if ( fd == NULL ) + { + printf("Some error occured"); + exit(1); + } fread (&readone, sizeof(sha512sum),1,fd); char* resulted_string = ak_fs_sha512sum_struct_to_string(readone); -- cgit v1.2.3