AP_HAL_SITL: avoid calling fcntl on -1

in-line the method to make setting non-blocking on _fd more proximate to where the thing is opened
This commit is contained in:
Peter Barker
2026-08-08 09:03:54 +10:00
committed by Peter Barker
parent 409226a637
commit b65870fbe7
2 changed files with 1 additions and 8 deletions
-7
View File
@@ -200,8 +200,6 @@ void UARTDriver::_begin(uint32_t baud, uint16_t rxSpace, uint16_t txSpace)
_readbuffer.clear();
_writebuffer.clear();
}
_set_nonblocking(_fd);
}
void UARTDriver::_end()
@@ -734,11 +732,6 @@ bool UARTDriver::_select_check(int fd)
return false;
}
void UARTDriver::_set_nonblocking(int fd)
{
unsigned v = fcntl(fd, F_GETFL, 0);
fcntl(fd, F_SETFL, v | O_NONBLOCK);
}
bool UARTDriver::set_unbuffered_writes(bool on) {
if (_fd == -1) {
+1 -1
View File
@@ -108,7 +108,7 @@ private:
void _udp_start_multicast(const char *address, uint16_t port);
void _check_connection(void);
static bool _select_check(int );
static void _set_nonblocking(int );
bool set_speed(int speed) const;
SITL_State *_sitlState;