From: Daniel Wagner <[email protected]>

---

Not handling the return code during initializing looks a bit
suspicious in my book. But that might be on purpose?

 src/profile.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/profile.c b/src/profile.c
index a74d870..630350f 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -450,11 +450,12 @@ static int profile_init(void)
 {
        GDir *dir;
        const gchar *file;
+       int err = 0;
 
        DBG("");
 
        dir = g_dir_open(STORAGEDIR, 0, NULL);
-       if (dir != NULL) {
+       if (dir != NULL && err >= 0) {
                while ((file = g_dir_read_name(dir)) != NULL) {
                        GString *str;
                        gchar *ident;
@@ -473,16 +474,26 @@ static int profile_init(void)
                        ident = g_string_free(str, FALSE);
 
                        if (connman_dbus_validate_ident(ident) == TRUE)
-                               create_profile(ident, NULL, NULL);
+                               err = create_profile(ident, NULL, NULL);
 
                        g_free(ident);
+
+                       if (err < 0)
+                               break;
                }
 
                g_dir_close(dir);
        }
 
-       if (default_profile == NULL)
-               create_profile(PROFILE_DEFAULT_IDENT, "Default", NULL);
+       if (err < 0)
+               return err;
+
+       if (default_profile == NULL) {
+               err = create_profile(PROFILE_DEFAULT_IDENT, "Default", NULL);
+
+               if (err < 0)
+                       return err;
+       }
 
        profiles_changed();
 
-- 
1.7.2.2

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to