Skip to content

Return OS_ERROR if OS_ObjectIdGetById fails in vxworks OS_ShellOutputToFile_Impl #1102

@skliper

Description

@skliper

Is your feature request related to a problem? Please describe.
Coverage test highlights somewhat unexpected behavior in the VxWorks OS_ShellOutputToFile_impl where it will still return success if OS_ObjectIdGetById doesn't return OS_SUCCESS. There isn't a real case where OS_ObjectIdGetById would fail that I know of, but the logic is a bit strange.

if (OS_ObjectIdGetById(OS_LOCK_MODE_NONE, OS_OBJECT_TYPE_OS_STREAM, fdCmd, &cmd_token) == OS_SUCCESS)
{
out_impl = OS_OBJECT_TABLE_GET(OS_impl_filehandle_table, *token);
cmd_impl = OS_OBJECT_TABLE_GET(OS_impl_filehandle_table, cmd_token);
/* copy the command to the file, and then seek back to the beginning of the file */
OS_write(fdCmd, Cmd, OS_strnlen(Cmd, OS_MAX_CMD_LEN));
OS_lseek(fdCmd, 0, OS_SEEK_SET);
/* Create a shell task the will run the command in the file, push output to OS_fd */
Result = shellGenericInit("INTERPRETER=Cmd", 0, localShellName, NULL, false, false, cmd_impl->fd, out_impl->fd,
out_impl->fd);
}
if (Result == OK)
{
/* Wait for the command to terminate */
do
{
taskDelay(sysClkRateGet());
} while (taskNameToId(localShellName) != ((TASK_ID)ERROR));
ReturnCode = OS_SUCCESS;
}

Describe the solution you'd like
Return OS_ERROR if there is an error.

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions