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>
This commit is contained in:
Claudiu Olteanu 2015-09-09 19:39:12 +03:00 committed by Dirk Hohndel
parent 30a410036b
commit 813f6f502f

View file

@ -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
{