From 4e359f955200593641b0b415dba27050fc0619f7 Mon Sep 17 00:00:00 2001 From: Jacob Dahl <37091262+dakejahl@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:22:46 -0800 Subject: [PATCH] set file descriptor to -1 after close() (#23751) --- src/drivers/cdcacm_autostart/cdcacm_autostart.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/drivers/cdcacm_autostart/cdcacm_autostart.cpp b/src/drivers/cdcacm_autostart/cdcacm_autostart.cpp index 3c963e7988..d86788ff7f 100644 --- a/src/drivers/cdcacm_autostart/cdcacm_autostart.cpp +++ b/src/drivers/cdcacm_autostart/cdcacm_autostart.cpp @@ -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