From: Daniel Wagner <[email protected]>
Also continue reading the rest of the policy files when starting up.
This makes the startup behavior consistent with the runtime
behavior.
---
plugins/session_policy_local.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/plugins/session_policy_local.c b/plugins/session_policy_local.c
index 0df4e74..ad79e66 100644
--- a/plugins/session_policy_local.c
+++ b/plugins/session_policy_local.c
@@ -384,6 +384,7 @@ static void notify_handler(struct inotify_event *event,
const char *ident)
{
struct policy_data *policy;
+ int err;
if (ident == NULL)
return;
@@ -410,7 +411,10 @@ static void notify_handler(struct inotify_event *event,
if (event->mask & IN_MODIFY) {
connman_info("Policy modifed for '%s'", ident);
- if (load_policy(policy) < 0) {
+ err = load_policy(policy);
+ if (err < 0) {
+ connman_warn("Loading policy file '%s' failed with %s",
+ ident, strerror(-err));
remove_policy(policy);
return;
}
@@ -426,10 +430,10 @@ static void notify_handler(struct inotify_event *event,
update_session(policy);
}
-static int read_policies(void)
+static void read_policies(void)
{
GDir *dir;
- int err = 0;
+ int err;
DBG("");
@@ -442,14 +446,17 @@ static int read_policies(void)
policy = create_policy(file);
err = load_policy(policy);
- if (err < 0)
- break;
+ if (err < 0) {
+ connman_warn("Loading policy file '%s' failed
with %s",
+ file, strerror(-err));
+ policy_unref(policy);
+ continue;
+ }
+
}
g_dir_close(dir);
}
-
- return err;
}
static int session_policy_local_init(void)
@@ -479,9 +486,7 @@ static int session_policy_local_init(void)
if (err < 0)
goto err;
- err = read_policies();
- if (err < 0)
- goto err_notify;
+ read_policies();
err = connman_session_policy_register(&session_policy_local);
if (err < 0)
--
1.8.2.rc3.16.gce432ca
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman