From: Daniel Wagner <daniel.wag...@bmw-carit.de>

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 8968d14..b0317bb 100644
--- a/plugins/session_policy_local.c
+++ b/plugins/session_policy_local.c
@@ -377,6 +377,7 @@ static void notify_handler(struct inotify_event *event,
                                         const char *ident)
 {
        struct policy_data *policy;
+       int err;
 
        if (ident == NULL)
                return;
@@ -398,7 +399,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;
                }
@@ -415,10 +419,10 @@ static void notify_handler(struct inotify_event *event,
                update_session(policy->session);
 }
 
-static int read_policies(void)
+static void read_policies(void)
 {
        GDir *dir;
-       int err = 0;
+       int err;
 
        DBG("");
 
@@ -431,14 +435,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)
@@ -466,9 +473,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.1.3.566.gaa39828

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to