From 543a2cd1a3f2efa3bb564d7472e2d283711a7b80 Mon Sep 17 00:00:00 2001 From: Jay Beavers Date: Thu, 18 Jul 2013 18:25:59 -0700 Subject: [PATCH] Check write(...) errno #43 --- src/serialport_unix.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/serialport_unix.cpp b/src/serialport_unix.cpp index ee23269..c9e8a54 100644 --- a/src/serialport_unix.cpp +++ b/src/serialport_unix.cpp @@ -231,9 +231,11 @@ void EIO_Write(uv_work_t* req) { QueuedWrite* queuedWrite = static_cast(req->data); WriteBaton* data = static_cast(queuedWrite->baton); - int bytesWritten = write(data->fd, data->bufferData, data->bufferLength); + data->result = write(data->fd, data->bufferData, data->bufferLength); + if ( data->result == -1 ) { + printf( "Error %d calling write(...)\n", errno ); + } - data->result = bytesWritten; } void EIO_Close(uv_work_t* req) {