diff options
author | Szymon Janc <szymon.janc@tieto.com> | 2013-11-05 15:18:48 +0100 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-11-06 10:08:15 +0200 |
commit | 6dc9321e2e8a01f505e18fcac9cce7a2013a391d (patch) | |
tree | be03cf3492d564047a15bad3fe90a08e57321c2c /android/main.c | |
parent | 8a98e083b8a58331fcecbb176f88a188a85e6996 (diff) | |
download | bluez-6dc9321e2e8a01f505e18fcac9cce7a2013a391d.tar.gz |
android: Stop mainloop if reading index list failed
If reading index list failed mainloop should be stopped since adapter
init guard timer is not yet running.
Diffstat (limited to 'android/main.c')
-rw-r--r-- | android/main.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/android/main.c b/android/main.c index 4bb5101ba..72e47f2cc 100644 --- a/android/main.c +++ b/android/main.c @@ -528,12 +528,12 @@ static void read_index_list_complete(uint8_t status, uint16_t length, if (status) { error("%s: Failed to read index list: %s (0x%02x)", __func__, mgmt_errstr(status), status); - return; + goto error; } if (length < sizeof(*rp)) { error("%s: Wrong size of read index list response", __func__); - return; + goto error; } num = btohs(rp->num_controllers); @@ -542,7 +542,7 @@ static void read_index_list_complete(uint8_t status, uint16_t length, if (num * sizeof(uint16_t) + sizeof(*rp) != length) { error("%s: Incorrect pkt size for index list rsp", __func__); - return; + goto error; } if (adapter_index != MGMT_INDEX_NONE) @@ -553,13 +553,17 @@ static void read_index_list_complete(uint8_t status, uint16_t length, adapter_timeout_handler, NULL); if (adapter_timeout == 0) { error("%s: Failed init timeout", __func__); - g_main_loop_quit(event_loop); + goto error; } return; } adapter_index = btohs(rp->index[0]); bt_adapter_init(adapter_index, mgmt_if, adapter_ready); + return; + +error: + g_main_loop_quit(event_loop); } static void read_commands_complete(uint8_t status, uint16_t length, |