From 1aad67995f423bb235cfe2a337882f6ce88cb4f2 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Mon, 15 Mar 2021 08:54:30 -0400 Subject: [PATCH] Fix #886, return moduleInfoGet error Propagate a VxWorks error on moduleInfoGet() call into OS_ERROR return. --- src/os/vxworks/src/os-impl-loader.c | 6 +++++- src/unit-test-coverage/vxworks/src/coveragetest-loader.c | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/os/vxworks/src/os-impl-loader.c b/src/os/vxworks/src/os-impl-loader.c index 49e693be4..2e0ef53ce 100644 --- a/src/os/vxworks/src/os-impl-loader.c +++ b/src/os/vxworks/src/os-impl-loader.c @@ -164,6 +164,7 @@ int32 OS_ModuleGetInfo_Impl(const OS_object_token_t *token, OS_module_prop_t *mo MODULE_INFO vxModuleInfo; STATUS vxStatus; OS_impl_module_internal_record_t *impl; + int32 return_code; impl = OS_OBJECT_TABLE_GET(OS_impl_module_table, *token); @@ -176,6 +177,7 @@ int32 OS_ModuleGetInfo_Impl(const OS_object_token_t *token, OS_module_prop_t *mo if (vxStatus == ERROR) { OS_DEBUG("OSAL: OS_ModuleInfoGet Error from vxWorks: %d\n", vxStatus); + return_code = OS_ERROR; } else { @@ -186,8 +188,10 @@ int32 OS_ModuleGetInfo_Impl(const OS_object_token_t *token, OS_module_prop_t *mo module_prop->addr.data_size = vxModuleInfo.segInfo.dataSize; module_prop->addr.bss_address = (cpuaddr)vxModuleInfo.segInfo.bssAddr; module_prop->addr.bss_size = vxModuleInfo.segInfo.bssSize; + + return_code = OS_SUCCESS; } - return (OS_SUCCESS); + return (return_code); } /* end OS_ModuleGetInfo_Impl */ diff --git a/src/unit-test-coverage/vxworks/src/coveragetest-loader.c b/src/unit-test-coverage/vxworks/src/coveragetest-loader.c index 505f69892..a949ad33d 100644 --- a/src/unit-test-coverage/vxworks/src/coveragetest-loader.c +++ b/src/unit-test-coverage/vxworks/src/coveragetest-loader.c @@ -87,12 +87,12 @@ void Test_OS_ModuleGetInfo_Impl(void) UtAssert_True(module_prop.addr.valid, "addresses in output valid"); /* - * Note this still returns SUCCESS if the underlying call fails, - * but the boolean in the output struct should be false. + * This returns OS_ERROR if the underlying call fails, + * and the boolean in the output struct should be false. */ memset(&module_prop, 0, sizeof(module_prop)); UT_SetDefaultReturnValue(UT_KEY(OCS_moduleInfoGet), OCS_ERROR); - OSAPI_TEST_FUNCTION_RC(OS_ModuleGetInfo_Impl(&token, &module_prop), OS_SUCCESS); + OSAPI_TEST_FUNCTION_RC(OS_ModuleGetInfo_Impl(&token, &module_prop), OS_ERROR); UT_ClearDefaultReturnValue(UT_KEY(OCS_moduleInfoGet)); UtAssert_True(!module_prop.addr.valid, "addresses in output not valid"); }