Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce close_safely helper function #763

Merged
merged 1 commit into from
Aug 15, 2023

Conversation

mnissler-rivos
Copy link
Contributor

The helper function centralizes some extra checks and diligence desired by many/most current code paths but currently inconsistently applied. This includes bypassing the close call when the file descriptor is -1 already, resetting the file descriptor variable to -1 after closing, and preserving errno.

All calls to close are replaced by close_safely. Some warning log output is lost over this, but it doesn't seem like this was very useful anyways given that Linux always closes the file descriptor anyways.

@jlevon
Copy link
Collaborator

jlevon commented Aug 15, 2023

please signoff your commit

lib/common.h Outdated Show resolved Hide resolved
lib/common.h Outdated Show resolved Hide resolved
The helper function centralizes some extra checks and diligence desired
by many/most current code paths but currently inconsistently applied.
This includes bypassing the close call when the file descriptor is -1
already, resetting the file descriptor variable to -1 after closing, and
preserving errno.

All calls to close are replaced by close_safely. Some warning log output
is lost over this, but it doesn't seem like this was very useful anyways
given that Linux always closes the file descriptor anyways.

Signed-off-by: Mattias Nissler <mnissler@rivosinc.com>
Copy link
Collaborator

@jlevon jlevon left a comment

Choose a reason for hiding this comment

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

Thanks - but please don't use force push during PR review, as it deletes all context from previous reviews, and I can't tell what changed and so on.

@jlevon jlevon merged commit e8c37f8 into nutanix:master Aug 15, 2023
5 checks passed
@mnissler-rivos
Copy link
Contributor Author

Thanks - but please don't use force push during PR review, as it deletes all context from previous reviews, and I can't tell what changed and so on.

I can still see the old commits, and the "Compare" links on the right show what has changed in a push. "View reviewed changes" seems broken though - is that what you are refering to?

Anyways, happy to follow whatever process you use for this project. Requested changes go into additional commits then?

@jlevon
Copy link
Collaborator

jlevon commented Aug 15, 2023

"show changes since last review" gets broken. In addition, any context for previous review comments is lost. Obviously for a small change it's no big deal, but the next one will be different!

So yeah, during review, we use additional commits, and then "squash and merge" at the very end to have a single commit per logical change without a bunch of noise.

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.

2 participants