Skip to content

if statement condition that never evaluates to true in src/libcrun/container.c #1942

@eriksjolund

Description

@eriksjolund

This if statement

crun/src/libcrun/container.c

Lines 1322 to 1324 in 96e9b99

ret = setup_terminal_socketpair (entrypoint_args, &console_socketpair);
if (UNLIKELY (ret < 0))
return ret;

has a condition that never evaluates to true because ret is always 0.

See function definition:

crun/src/libcrun/container.c

Lines 1145 to 1154 in 96e9b99

static int
setup_terminal_socketpair (struct container_entrypoint_s *entrypoint_args, int *console_socketpair)
{
if (entrypoint_args->terminal_socketpair[0] >= 0)
{
close_and_reset (&entrypoint_args->terminal_socketpair[0]);
*console_socketpair = entrypoint_args->terminal_socketpair[1];
}
return 0;
}

discussion

If it is a design choice to check the return value (for the same reason as in #1285 (comment)), then crun_make_error() is missing in the line

return ret;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions