AP_HAL_SITL: avoid calling fcntl on -1 - #33170
Merged
Merged
Conversation
hunt0r
approved these changes
May 23, 2026
khancyr
suggested changes
Jun 17, 2026
khancyr
left a comment
Contributor
There was a problem hiding this comment.
well, that is still wrong.
we should remove this.
only uart need it and it is already set on _uart_start_connection
socket shouldn't need it and calling it on begin is useless for them as they build the fd after.
Only left the _console that shouldn't set it either.
So we should remove this
khancyr
suggested changes
Jun 17, 2026
Comment on lines
+204
to
+208
| // _fd may be -1 for device types that don't open an fd above | ||
| if (_fd != -1) { | ||
| unsigned v = fcntl(_fd, F_GETFL, 0); | ||
| fcntl(_fd, F_SETFL, v | O_NONBLOCK); | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| // _fd may be -1 for device types that don't open an fd above | |
| if (_fd != -1) { | |
| unsigned v = fcntl(_fd, F_GETFL, 0); | |
| fcntl(_fd, F_SETFL, v | O_NONBLOCK); | |
| } |
remove this
in-line the method to make setting non-blocking on _fd more proximate to where the thing is opened
peterbarker
force-pushed
the
pr-claude/fcntl-on--1
branch
from
June 24, 2026 10:07
d76dbb2 to
f887e8a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stops SITL calling fcntl on an invalid file descriptor. Shuts valgrind up about it.
Classification & Testing (check all that apply and add your own)
Description
in-line the method to make setting non-blocking on _fd more proximate to where the thing is opened