diff --git a/tests/utests/schema_comparison/test_schema_comparison.c b/tests/utests/schema_comparison/test_schema_comparison.c index 5beac6b27e..d10fce14be 100644 --- a/tests/utests/schema_comparison/test_schema_comparison.c +++ b/tests/utests/schema_comparison/test_schema_comparison.c @@ -135,7 +135,7 @@ schema_comparison(struct sc_state *st, const char *module_name) fseek(st->f, 0, SEEK_SET); st->exp = malloc(size + 1); assert_non_null(st->exp); - assert_int_equal(size, fread(st->exp, 1, size, st->f)); + size = fread(st->exp, 1, size, st->f); st->exp[size] = '\0'; /* compare the output */ diff --git a/tests/yangupdate/complex_update/test.c b/tests/yangupdate/complex_update/test.c index 6eae091823..ceeba1007a 100644 --- a/tests/yangupdate/complex_update/test.c +++ b/tests/yangupdate/complex_update/test.c @@ -104,7 +104,7 @@ test_update_01_01_to_01_20(void **state) rewind(st->f); st->str1 = malloc(size + 1); assert_non_null(st->str1); - fread(st->str1, 1, size, st->f); + size = fread(st->str1, 1, size, st->f); st->str1[size] = '\0'; assert_string_equal(st->str2, st->str1); } @@ -140,7 +140,7 @@ test_update_01_10_to_01_15(void **state) rewind(st->f); st->str1 = malloc(size + 1); assert_non_null(st->str1); - fread(st->str1, 1, size, st->f); + size = fread(st->str1, 1, size, st->f); st->str1[size] = '\0'; assert_string_equal(st->str2, st->str1); } @@ -177,7 +177,7 @@ test_update_01_15_to_01_20(void **state) rewind(st->f); st->str1 = malloc(size + 1); assert_non_null(st->str1); - fread(st->str1, 1, size, st->f); + size = fread(st->str1, 1, size, st->f); st->str1[size] = '\0'; assert_string_equal(st->str2, st->str1); } diff --git a/tools/update/CMakeLists.txt b/tools/update/CMakeLists.txt index a734688dbf..49bdf2cd64 100644 --- a/tools/update/CMakeLists.txt +++ b/tools/update/CMakeLists.txt @@ -42,6 +42,7 @@ endif() # yang update library add_library(${LIB_NAME} STATIC ${lib_src}) +target_compile_definitions(${LIB_NAME} PUBLIC LIBYANG_BUILD) target_include_directories(${LIB_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${PROJECT_BINARY_DIR}) get_target_property(yang_linked_libraries yang LINK_LIBRARIES) target_link_libraries(${LIB_NAME} $ ${yang_linked_libraries}) diff --git a/tools/update/yang_update.c b/tools/update/yang_update.c index 0ea811a09d..f036d3e38a 100644 --- a/tools/update/yang_update.c +++ b/tools/update/yang_update.c @@ -583,7 +583,7 @@ yu_module_imp_clb(const char *mod_name, const char *mod_rev, const char *submod_ rc = LY_EMEM; goto cleanup; } - fread(data, 1, size, f); + size = fread(data, 1, size, f); data[size] = '\0'; *format = fmt;