Skip to content

Commit

Permalink
Fix nasa#1477, CFE_ES_GetTaskName return code no longer misleading
Browse files Browse the repository at this point in the history
  • Loading branch information
zanzaben committed Jun 15, 2021
1 parent 564042e commit d65be31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/es_task_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 5 additions & 1 deletion modules/es/fsw/src/cfe_es_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d65be31

Please sign in to comment.