mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 14:58:53 +08:00
set file descriptor to -1 after close() (#23751)
This commit is contained in:
@@ -76,6 +76,7 @@ CdcAcmAutostart::~CdcAcmAutostart()
|
|||||||
|
|
||||||
if (_ttyacm_fd >= 0) {
|
if (_ttyacm_fd >= 0) {
|
||||||
px4_close(_ttyacm_fd);
|
px4_close(_ttyacm_fd);
|
||||||
|
_ttyacm_fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScheduleClear();
|
ScheduleClear();
|
||||||
@@ -344,6 +345,7 @@ void CdcAcmAutostart::state_disconnecting()
|
|||||||
|
|
||||||
if (_ttyacm_fd > 0) {
|
if (_ttyacm_fd > 0) {
|
||||||
px4_close(_ttyacm_fd);
|
px4_close(_ttyacm_fd);
|
||||||
|
_ttyacm_fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disconnect serial
|
// Disconnect serial
|
||||||
|
|||||||
Reference in New Issue
Block a user