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

cmd/policy: Close file descriptor if required #23945

Merged
merged 2 commits into from Mar 1, 2023
Merged

Conversation

jiuker
Copy link
Contributor

@jiuker jiuker commented Feb 22, 2023

Please ensure your pull request adheres to the following guidelines:

  • For first time contributors, read Submitting a pull request
  • All code is covered by unit and/or runtime tests where feasible.
  • All commits contain a well written commit description including a title,
    description and a Fixes: #XXX line if the commit addresses a particular
    GitHub issue.
  • If your commit description contains a Fixes: <commit-id> tag, then
    please add the commit author[s] as reviewer[s] to this issue.
  • All commits are signed off. See the section Developer’s Certificate of Origin
  • Provide a title or release-note blurb suitable for the release notes.
  • Thanks for contributing!

close file fd

Fixes: None

cmd/policy: Close file descriptor if required

close file fd

Signed-off-by: jiuker <2818723467@qq.com>
@jiuker jiuker requested a review from a team as a code owner February 22, 2023 16:44
@jiuker jiuker requested a review from squeed February 22, 2023 16:44
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Feb 22, 2023
@github-actions github-actions bot added the kind/community-contribution This was a contribution made by a community member. label Feb 22, 2023
Copy link
Contributor

@squeed squeed left a comment

Choose a reason for hiding this comment

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

Two things: can you properly set the labels?

And, secondly, rather than doing a type assertion, I'd suggest something like this:

fp, err := os.Open(path)
if err != nil {
	return nil, err
}
defer fp.Close()
r = fp

Signed-off-by: jiuker <2818723467@qq.com>
@jiuker jiuker requested a review from squeed February 25, 2023 00:01
@jiuker
Copy link
Contributor Author

jiuker commented Feb 25, 2023

Two things: can you properly set the labels?

And, secondly, rather than doing a type assertion, I'd suggest something like this:

fp, err := os.Open(path)
if err != nil {
	return nil, err
}
defer fp.Close()
r = fp

1.I don't have permission to modify pr's label
2.I have modified this pr like you requested
@squeed

@squeed squeed added the release-note/misc This PR makes changes that have no direct user impact. label Feb 27, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Feb 27, 2023
@squeed
Copy link
Contributor

squeed commented Feb 27, 2023

/test

@squeed
Copy link
Contributor

squeed commented Feb 27, 2023

1.I don't have permission to modify pr's label

My mistake; added.

Tests seem to have failed for an unrelated reason; let's see if they go green.

@sayboras sayboras changed the title fix:should close file fd cmd/policy: Close file descriptor if required Feb 28, 2023
@sayboras
Copy link
Member

/test

@sayboras sayboras requested a review from a team February 28, 2023 10:34
@sayboras
Copy link
Member

sayboras commented Mar 1, 2023

Conformance GatewayAPI failure is due to lack of rebase with master. Reviews are in, all CI jobs are good.

Marking this ready to merge.

@sayboras sayboras added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Mar 1, 2023
@sayboras sayboras merged commit 5a6e74e into cilium:master Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/community-contribution This was a contribution made by a community member. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants