summaryrefslogtreecommitdiffstats
path: root/binding/bluetooth-conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'binding/bluetooth-conf.c')
-rw-r--r--binding/bluetooth-conf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/binding/bluetooth-conf.c b/binding/bluetooth-conf.c
index 2f6f475..ff888d6 100644
--- a/binding/bluetooth-conf.c
+++ b/binding/bluetooth-conf.c
@@ -66,7 +66,14 @@ int set_default_adapter(afb_api_t api, const char *adapter)
json_object_object_add(query, "value", json_object_new_string(adapter));
ret = afb_api_call_sync(api, "persistence", "update", query, &response, NULL, NULL);
+ if (ret < 0) {
+ ret = afb_api_call_sync(api, "persistence", "insert", query, &response, NULL, NULL);
+ if (ret < 0)
+ goto out;
+ }
+
json_object_put(response);
+out:
return ret;
}