diff options
author | Yun-Hao Chung <howardchung@chromium.org> | 2021-09-06 14:03:17 +0800 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-09-15 16:38:59 -0700 |
commit | b22dc8accfd72cac29555c90efdb545dc200af02 (patch) | |
tree | acb41f97b4ac29be5cf65b798e32196de51e77d2 /plugins | |
parent | bf88ab8383d4bff25ec25a3ea1a832c3cfd4ac9c (diff) | |
download | bluez-b22dc8accfd72cac29555c90efdb545dc200af02.tar.gz |
plugins/admin: create admin_policy_settings if not exists
If admin_policy_settings is not found when loading, we should create one
instead of printing error.
Reviewed-by: Shyh-In Hwang <josephsih@chromium.org>
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/admin.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/plugins/admin.c b/plugins/admin.c index 82c00cabd..8390f3c32 100644 --- a/plugins/admin.c +++ b/plugins/admin.c @@ -67,7 +67,7 @@ static struct btd_admin_policy *admin_policy_new(struct btd_adapter *adapter) admin_policy->adapter = adapter; admin_policy->adapter_id = btd_adapter_get_index(adapter); - admin_policy->service_allowlist = NULL; + admin_policy->service_allowlist = queue_new(); return admin_policy; } @@ -335,12 +335,8 @@ static void load_policy_settings(struct btd_admin_policy *admin_policy) char *filename = ADMIN_POLICY_STORAGE; struct stat st; - if (stat(filename, &st) < 0) { - btd_error(admin_policy->adapter_id, - "Failed to get file %s information", - filename); - return; - } + if (stat(filename, &st) < 0) + store_policy_settings(policy_data); key_file = g_key_file_new(); |