Clean up of printf to use sprintf and return the error via the Baton

This commit is contained in:
Jay Beavers 2013-07-18 18:39:28 -07:00
parent 543a2cd1a3
commit fc971dc834

View file

@ -217,13 +217,11 @@ void EIO_Open(uv_work_t* req) {
#if defined(MAC_OS_X_VERSION_10_4) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4)
speed_t speed = data->baudRate;
if ( ioctl( fd, IOSSIOSPEED, &speed ) == -1 )
{
printf( "Error %d calling ioctl( ..., IOSSIOSPEED, ... )\n", errno );
if (ioctl(fd, IOSSIOSPEED, &speed) == -1) {
sprintf(data->errorString, "Error %d calling ioctl( ..., IOSSIOSPEED, ... )\n", errno );
}
#endif
data->result = fd;
}
@ -231,11 +229,9 @@ void EIO_Write(uv_work_t* req) {
QueuedWrite* queuedWrite = static_cast<QueuedWrite*>(req->data);
WriteBaton* data = static_cast<WriteBaton*>(queuedWrite->baton);
data->result = write(data->fd, data->bufferData, data->bufferLength);
if ( data->result == -1 ) {
printf( "Error %d calling write(...)\n", errno );
if (data->result = write(data->fd, data->bufferData, data->bufferLength) == -1) {
sprintf(data->errorString, "Error %d calling write(...)\n", errno );
}
}
void EIO_Close(uv_work_t* req) {