Skip to content

Avoid accessing errno on unexpected return values.#810

Merged
josephlr merged 1 commit intorust-random:masterfrom
briansmith:b/unexpected
Feb 18, 2026
Merged

Avoid accessing errno on unexpected return values.#810
josephlr merged 1 commit intorust-random:masterfrom
briansmith:b/unexpected

Conversation

@briansmith
Copy link
Contributor

We expect that these system calls will never return anything other than 0 or -1 but if they do for some reason, then we shouldn't access errno.

@briansmith
Copy link
Contributor Author

I could not find the documentation for VxWorks randABytes so I don't know if it has the same issue.

Copy link
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

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

Did you intentionally remove the check for getentropy?

@briansmith briansmith force-pushed the b/unexpected branch 3 times, most recently from 0cc05bb to 0fef0d8 Compare February 17, 2026 23:54
@briansmith
Copy link
Contributor Author

Did you intentionally remove the check for getentropy?

Nope. Thanks for catching that. I was originally planning to do the references to POSIX in a separate PR but decided to merge them at the last minute, but then messed up the merge. Fixed.

Copy link
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

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

It's worth to rebase and add a changelog entry for this PR as well.

Copy link
Member

@josephlr josephlr left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for the fix!

We expect that these system calls will never return anything other
than 0 or -1 but if they do for some reason, then we shouldn't
access `errno`.
@briansmith
Copy link
Contributor Author

Rebased with updated changelog.

@josephlr josephlr merged commit b83c779 into rust-random:master Feb 18, 2026
78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments