diff --git a/modules/cfe_testcase/src/es_task_test.c b/modules/cfe_testcase/src/es_task_test.c index 1c3d892fc..8cc55b155 100644 --- a/modules/cfe_testcase/src/es_task_test.c +++ b/modules/cfe_testcase/src/es_task_test.c @@ -120,7 +120,7 @@ void TestChildTaskName(void) UtAssert_INT32_EQ(CFE_ES_GetTaskName(NULL, TaskId, sizeof(TaskNameBuf)), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, CFE_ES_TASKID_UNDEFINED, sizeof(TaskNameBuf)), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskName) - 4), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskName) - 4), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_SUCCESS); } diff --git a/modules/es/fsw/src/cfe_es_api.c b/modules/es/fsw/src/cfe_es_api.c index e58327320..424a082e2 100644 --- a/modules/es/fsw/src/cfe_es_api.c +++ b/modules/es/fsw/src/cfe_es_api.c @@ -987,10 +987,14 @@ CFE_Status_t CFE_ES_GetTaskName(char *TaskName, CFE_ES_TaskId_t TaskId, size_t B OsalId = CFE_ES_TaskId_ToOSAL(TaskId); Result = OS_GetResourceName(OsalId, TaskName, BufferLength); - if (Result != OS_SUCCESS) + if (Result == OS_ERR_INVALID_ID) { return CFE_ES_ERR_RESOURCEID_NOT_VALID; } + else if (Result != OS_SUCCESS) + { + return CFE_STATUS_EXTERNAL_RESOURCE_FAIL; + } return CFE_SUCCESS; } diff --git a/modules/es/ut-coverage/es_UT.c b/modules/es/ut-coverage/es_UT.c index f788e2704..97ec5db09 100644 --- a/modules/es/ut-coverage/es_UT.c +++ b/modules/es/ut-coverage/es_UT.c @@ -4202,8 +4202,11 @@ void TestAPI(void) CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetTaskName(NULL, TaskId, sizeof(AppName)), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_SUCCESS); - UT_SetDeferredRetcode(UT_KEY(OS_GetResourceName), 1, OS_ERROR); + UT_SetDeferredRetcode(UT_KEY(OS_GetResourceName), 1, OS_ERR_INVALID_ID); UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UT_SetDeferredRetcode(UT_KEY(OS_GetResourceName), 1, OS_ERROR); + UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, NULL), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, AppName), CFE_SUCCESS);