From 5b8893c647c41d018576bac3f3e98d6017d703c0 Mon Sep 17 00:00:00 2001 From: VL-80 Date: Sun, 30 Jan 2022 14:10:03 -0500 Subject: [PATCH] bluez/gattlib_adapter.c: Fix bug The checking of the result of the hci_open_dev() function needs to be done on the derefenced value, not the pointer (which can not be negative). --- bluez/gattlib_adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluez/gattlib_adapter.c b/bluez/gattlib_adapter.c index 2f679a7..65a3f3d 100644 --- a/bluez/gattlib_adapter.c +++ b/bluez/gattlib_adapter.c @@ -72,7 +72,7 @@ int gattlib_adapter_open(const char* adapter_name, void** adapter) { } *device_desc = hci_open_dev(dev_id); - if (device_desc < 0) { + if (*device_desc < 0) { fprintf(stderr, "ERROR: Could not open device.\n"); return GATTLIB_DEVICE_ERROR; }