Skip to content

rust: check range and add type invariant to Error (issue #295) - #324

Merged
ojeda merged 1 commit into
Rust-for-Linux:rustfrom
foxhlchen:295-ERROR-invariant
Jun 3, 2021
Merged

ojeda merged 1 commit into
Rust-for-Linux:rustfrom
foxhlchen:295-ERROR-invariant

Conversation

@foxhlchen

@foxhlchen foxhlchen commented May 31, 2021 •

Copy link
Copy Markdown

We will need to make sure that no Error with out of
range error code can be constructed.

This commit

  1. Add errno check in from_kernel_errno()
  2. Provides a unchecked version from_kernel_errno_unchecked()

And when an invalid errno is found, it will

  1. Print a warning.
  2. Convert it to EINVAL.

Signed-off-by: Fox Chen foxhlchen@gmail.com

Issue #295

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants