diff --git a/src/DUNE/Hardware/SocketCAN.cpp b/src/DUNE/Hardware/SocketCAN.cpp index 897f31c3ac..cec54c4857 100644 --- a/src/DUNE/Hardware/SocketCAN.cpp +++ b/src/DUNE/Hardware/SocketCAN.cpp @@ -171,6 +171,7 @@ namespace DUNE size_t SocketCAN::doWrite(const uint8_t* bfr, size_t size) { // TODO: Add exceptions #if defined(DUNE_OS_LINUX) + ssize_t bytes_written; switch(can_frame_type) { case CAN_BASIC_SFF: case CAN_BASIC_EFF: @@ -178,18 +179,19 @@ namespace DUNE frame.can_dlc = size; frame.can_id = cantxid; memcpy(frame.data, bfr, size); - ::write(m_can_socket, &frame, CAN_MTU); + bytes_written = ::write(m_can_socket, &frame, CAN_MTU); break; case CAN_FD: struct canfd_frame fdframe; fdframe.len = size; fdframe.can_id = cantxid; memcpy(fdframe.data, bfr, size); - ::write(m_can_socket, &fdframe, CANFD_MTU); + bytes_written = ::write(m_can_socket, &fdframe, CANFD_MTU); break; default: throw Error("Frame type not recognized", System::Error::getLastMessage()); } + (void)bytes_written; return size; #else throw Error("Could not complete", "Unimplemented");