Skip to content

refactor: ignore other return values when an error occurs#5369

Open
lifubang wants to merge 1 commit into
opencontainers:mainfrom
lifubang:refactor-5347
Open

refactor: ignore other return values when an error occurs#5369
lifubang wants to merge 1 commit into
opencontainers:mainfrom
lifubang:refactor-5347

Conversation

@lifubang

Copy link
Copy Markdown
Member

we shouldn't trust waitKill when we got the error EINVAL.

Ref:
#5367 (comment)
#5367 (comment)

we shouldn't trust `waitKill` when we got the error `EINVAL`.

Suggested-by: Sebastiaan van Stijn <github@gone.nl>
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: lifubang <lifubang@acmcoder.com>
@lifubang lifubang added the kind/refactor refactoring label Jul 11, 2026
Comment on lines +676 to 682
if waitKill, err := filter.GetWaitKill(); err != nil {
if !errors.Is(err, unix.EINVAL) {
return 0, false, fmt.Errorf("unable to fetch SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV bit: %w", err)
}
} else if waitKill {
flags |= uint(C.C_FILTER_FLAG_WAIT_KILLABLE_RECV)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we really want to switch it over, I think better describes what we are doing, but I don't really mind too much either way.

Suggested change
if waitKill, err := filter.GetWaitKill(); err != nil {
if !errors.Is(err, unix.EINVAL) {
return 0, false, fmt.Errorf("unable to fetch SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV bit: %w", err)
}
} else if waitKill {
flags |= uint(C.C_FILTER_FLAG_WAIT_KILLABLE_RECV)
}
waitKill, err := filter.GetWaitKill()
if errors.Is(err, unix.EINVAL) {
waitKill, err = false, nil
}
if err != nil {
return 0, false, fmt.Errorf("unable to fetch SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV bit: %w", err)
}
if waitKill {
flags |= uint(C.C_FILTER_FLAG_WAIT_KILLABLE_RECV)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants