config: Warn user if no configuration is found
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Thu, 12 Apr 2012 11:30:50 +0000 (14:30 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 17 Apr 2012 10:36:50 +0000 (13:36 +0300)
This is useful so that user gets information that he needs to
fix the config file.

src/config.c

index db15228..9b98f71 100644 (file)
@@ -378,7 +378,7 @@ static int load_config(struct connman_config *config)
        gsize length;
        char **groups;
        char *str;
-       gboolean protected;
+       gboolean protected, found = FALSE;
        int i;
 
        DBG("config %p", config);
@@ -412,10 +412,17 @@ static int load_config(struct connman_config *config)
        groups = g_key_file_get_groups(keyfile, &length);
 
        for (i = 0; groups[i] != NULL; i++) {
-               if (g_str_has_prefix(groups[i], "service_") == TRUE)
-                       load_service(keyfile, groups[i], config);
+               if (g_str_has_prefix(groups[i], "service_") == TRUE) {
+                       if (load_service(keyfile, groups[i], config) == 0)
+                               found = TRUE;
+               }
        }
 
+       if (found == FALSE)
+               connman_warn("Config file %s/%s.config does not contain any "
+                       "configuration that can be provisioned!",
+                       STORAGEDIR, config->ident);
+
        g_strfreev(groups);
 
        g_key_file_free(keyfile);