[PATCH] session_polici_ivi: Register notify handler after hash table init

Daniel Wagner wagi at monom.org
Thu Nov 29 05:41:27 PST 2012


From: Daniel Wagner <daniel.wagner at bmw-carit.de>

Let's move the registration after the hash table init.
---
 plugins/session_policy_ivi.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/plugins/session_policy_ivi.c b/plugins/session_policy_ivi.c
index e107c03..e967eb8 100644
--- a/plugins/session_policy_ivi.c
+++ b/plugins/session_policy_ivi.c
@@ -468,10 +468,6 @@ static int session_policy_ivi_init(void)
 {
 	int err;
 
-	err = connman_inotify_register(POLICYDIR, notify_handler);
-	if (err < 0)
-		return err;
-
 	connection = connman_dbus_get_connection();
 	if (connection == NULL)
 		return -EIO;
@@ -496,10 +492,16 @@ static int session_policy_ivi_init(void)
 		goto err;
 	}
 
-	err = read_policies();
+	err = connman_inotify_register(POLICYDIR, notify_handler);
 	if (err < 0)
 		goto err;
 
+	err = read_policies();
+	if (err < 0) {
+		connman_inotify_unregister(POLICYDIR, notify_handler);
+		goto err;
+	}
+
 	return 0;
 
 err:
@@ -512,7 +514,6 @@ err:
 
 	dbus_connection_unref(connection);
 
-	connman_inotify_unregister(POLICYDIR, notify_handler);
 
 	return err;
 }
-- 
1.8.0.rc0




More information about the connman mailing list