Skip to content

Commit

Permalink
Added assertion to file descriptor close
Browse files Browse the repository at this point in the history
  • Loading branch information
kent-williams committed Apr 18, 2017
1 parent 6ed0e1d commit c7cafac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libsweep/src/unix/serial.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,11 @@ void device_destruct(device_s serial) {

error_s ignore = nullptr;
device_flush(serial, &ignore);
close(serial->fd);

if (close(serial->fd) == -1) {
SWEEP_ASSERT(false && "closing file descriptor during destruct failed");
}

(void)ignore; // nothing we can do here

delete serial;
Expand Down

0 comments on commit c7cafac

Please sign in to comment.