diff options
author | Claudiu Olteanu <olteanu.claudiu@ymail.com> | 2015-09-09 19:39:12 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-09 13:05:38 -0700 |
commit | 813f6f502ff3edbb6dabf8d88f5bff84745c193c (patch) | |
tree | 35229e8585adfb2cd68488229efc7ef24f8c41b5 | |
parent | 30a410036b30f7f183619637d2ab31c7699b8324 (diff) | |
download | subsurface-813f6f502ff3edbb6dabf8d88f5bff84745c193c.tar.gz |
Exit with failure if the first dc_open method fails
If the dc_serial_*_open method fails then we should exit with
an error and don't try to open the device using the native
implementation.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | libdivecomputer.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c index 3e4cfada7..3c699005e 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -941,13 +941,10 @@ const char *do_libdivecomputer_import(device_data_t *data) #endif } - if (serial_device) { - if (rc == DC_STATUS_SUCCESS) { - rc = dc_device_custom_open(&data->device, data->context, data->descriptor, serial_device); - } else { - report_error(errmsg(rc)); - } - + if (rc != DC_STATUS_SUCCESS) { + report_error(errmsg(rc)); + } else if (serial_device) { + rc = dc_device_custom_open(&data->device, data->context, data->descriptor, serial_device); } else { #else { |