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 committed Sep 30, 2024
1 parent 28d960f commit b89db55
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 b89db55

Please sign in to comment.