Skip to content
Permalink
Browse files

Bluetooth: Settings: Fix not allowing custom handlers without arguments

Custom handlers without any arguments don't since there is a check for
argc > 1, to fix this behavior removing the check.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
  • Loading branch information...
Vudentz authored and jhedberg committed Apr 11, 2019
1 parent 755a6e5 commit f7b4069ac212b718369c806939de9486ee0f8150
Showing with 7 additions and 12 deletions.
  1. +7 −12 subsys/bluetooth/host/settings.c
@@ -89,20 +89,15 @@ int bt_settings_decode_key(char *key, bt_addr_le_t *addr)
static int set(int argc, char **argv, void *value_ctx)
{
int len;
const struct bt_settings_handler *h;

if (argc > 1) {
const struct bt_settings_handler *h;

for (h = _bt_settings_start; h < _bt_settings_end; h++) {
if (!strcmp(argv[0], h->name)) {
argc--;
argv++;
for (h = _bt_settings_start; h < _bt_settings_end; h++) {
if (!strcmp(argv[0], h->name)) {
argc--;
argv++;

return h->set(argc, argv, value_ctx);
}
return h->set(argc, argv, value_ctx);
}

return -ENOENT;
}

if (!strcmp(argv[0], "id")) {
@@ -182,7 +177,7 @@ static int set(int argc, char **argv, void *value_ctx)
}
#endif /* CONFIG_BT_PRIVACY */

return 0;
return -ENOENT;
}

#define ID_DATA_LEN(array) (bt_dev.id_count * sizeof(array[0]))

0 comments on commit f7b4069

Please sign in to comment.
You can’t perform that action at this time.