set file descriptor to -1 after close()

This commit is contained in:
Jacob Dahl
2024-10-01 13:13:18 -04:00
committed by Daniel Agar
parent dd5e81470c
commit 93eef0c787
@@ -76,6 +76,7 @@ CdcAcmAutostart::~CdcAcmAutostart()
if (_ttyacm_fd >= 0) {
px4_close(_ttyacm_fd);
_ttyacm_fd = -1;
}
ScheduleClear();
@@ -344,6 +345,7 @@ void CdcAcmAutostart::state_disconnecting()
if (_ttyacm_fd > 0) {
px4_close(_ttyacm_fd);
_ttyacm_fd = -1;
}
// Disconnect serial