diff --git a/libsweep/src/unix/serial.cc b/libsweep/src/unix/serial.cc index 18f35b6..448ccb4 100644 --- a/libsweep/src/unix/serial.cc +++ b/libsweep/src/unix/serial.cc @@ -353,6 +353,11 @@ void device_destruct(device_s serial) { error_s ignore = nullptr; device_flush(serial, &ignore); + + if (close(serial->fd) == -1) { + SWEEP_ASSERT(false && "closing file descriptor during destruct failed"); + } + (void)ignore; // nothing we can do here delete serial;