From 8932b2a936a237284e0bffcea562c406551ab433 Mon Sep 17 00:00:00 2001 From: Claudiu Olteanu Date: Mon, 7 Sep 2015 00:54:31 +0300 Subject: [PATCH] Fix dc_serial_native_open return check for Shearwater family The dc_serial_native_open method doesn't return -1 on failures. The failure errors can be DC_STATUS_INVALIDARGS, DC_STATUS_NOMEMORY, DC_STATUS_IO. Therefore we should check if the returned value is equal to DC_STATUS_SUCCESS and pass it further. Signed-off-by: Claudiu Olteanu Signed-off-by: Dirk Hohndel --- src/shearwater_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shearwater_common.c b/src/shearwater_common.c index 0b05e53..801fce6 100644 --- a/src/shearwater_common.c +++ b/src/shearwater_common.c @@ -43,9 +43,9 @@ shearwater_common_open (shearwater_common_device_t *device, dc_context_t *contex { // Open the device. int rc = dc_serial_native_open (&device->serial, context, name); - if (rc == -1) { + if (rc != DC_STATUS_SUCCESS) { ERROR (context, "Failed to open the serial port."); - return DC_STATUS_IO; + return rc; } // Set the serial communication protocol (115200 8N1).