[PATCH BlueZ v2 6/6] core/advertising: improve errors for add advertising

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the error string and check the size of the response when we get
response from the add advertising command.
---
 src/advertising.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/advertising.c b/src/advertising.c
index 46de9b4..7d69ee1 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -402,7 +402,13 @@ static void add_advertising_callback(uint8_t status, uint16_t length,
 	const struct mgmt_rp_add_advertising *rp = param;
 
 	if (status || !param) {
-		error("Failed to add advertising MGMT");
+		error("Failed to add advertisement: %s (0x%02x)",
+						mgmt_errstr(status), status);
+		return;
+	}
+
+	if (length < sizeof(*rp)) {
+		error("Wrong size of add advertising response");
 		return;
 	}
 
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux