Skip to content

Commit

Permalink
set file descriptor to -1 after close()
Browse files Browse the repository at this point in the history
  • Loading branch information
dakejahl authored and dagar committed Oct 1, 2024
1 parent dd5e814 commit 93eef0c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/drivers/cdcacm_autostart/cdcacm_autostart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ CdcAcmAutostart::~CdcAcmAutostart()

if (_ttyacm_fd >= 0) {
px4_close(_ttyacm_fd);
_ttyacm_fd = -1;
}

ScheduleClear();
Expand Down Expand Up @@ -344,6 +345,7 @@ void CdcAcmAutostart::state_disconnecting()

if (_ttyacm_fd > 0) {
px4_close(_ttyacm_fd);
_ttyacm_fd = -1;
}

// Disconnect serial
Expand Down

0 comments on commit 93eef0c

Please sign in to comment.