-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
api: Move close function in condition body #24277
base: main
Are you sure you want to change the base?
Conversation
The close is replaced in the body of the error condition. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Tigran Sogomonian <tsogomonian@astralinux.ru>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mi4r The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Ephemeral COPR build failed. @containers/packit-build please check. |
approved not having tests |
in looking at this PR, I saw the the error is not handled or logged. Then looking at just this file more broadly, sometimes it is and sometimes not. Some are deferred. If we have a consensus on how these should handled in the whole file, I would prefer that. I did not look close enough to verify that this is a possibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggested this but it only makes sense if the error on tmpfile.Close() above source = tmpfile.Name()
is checked and so that there was no errors during write.
Using defer in this context is not helpful because we want the tmpfile to be closed before we pass the file path to the import API.
I don't think there's value in logging the error from close. Maybe do an explicit |
Read the close() man page, there absolute is a reason to check for errors (even when super unlikely)
I know we ignore this pretty much elsewhere but here we are actually writing something potential large that my increase the odds of hitting such cases. |
The close is moved in the body of the error condition.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Does this PR introduce a user-facing change?