From 3daba977e0b93fa6fb3736dc42e9ff3c4bc3ff20 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Sat, 29 Apr 2017 12:21:54 +0200 Subject: [PATCH] Don't ignore handshaking errors --- src/uwatec_meridian.c | 6 +++++- src/uwatec_smart.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/uwatec_meridian.c b/src/uwatec_meridian.c index 077ec31..d59b855 100644 --- a/src/uwatec_meridian.c +++ b/src/uwatec_meridian.c @@ -228,7 +228,11 @@ uwatec_meridian_device_open (dc_device_t **out, dc_context_t *context, const cha dc_serial_purge (device->port, DC_DIRECTION_ALL); // Perform the handshaking. - uwatec_meridian_handshake (device); + status = uwatec_meridian_handshake (device); + if (status != DC_STATUS_SUCCESS) { + ERROR (context, "Failed to handshake with the device."); + goto error_close; + } *out = (dc_device_t*) device; diff --git a/src/uwatec_smart.c b/src/uwatec_smart.c index 2b94a3b..425e76e 100644 --- a/src/uwatec_smart.c +++ b/src/uwatec_smart.c @@ -191,7 +191,11 @@ uwatec_smart_device_open (dc_device_t **out, dc_context_t *context) } // Perform the handshaking. - uwatec_smart_handshake (device); + status = uwatec_smart_handshake (device); + if (status != DC_STATUS_SUCCESS) { + ERROR (context, "Failed to handshake with the device."); + goto error_close; + } *out = (dc_device_t*) device;