This is useful so that user gets information that he needs to
fix the config file.
---
Hi,

I was doing some wpa eap testing and created a config file for that.
Unfortunately the config file I created had an error, then connmand
read the file but ignored it silently. This patch prints a warning
if the config file does not contain anything that can be provisioned.

Cheers,
Jukka


 src/config.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/config.c b/src/config.c
index db15228..9b98f71 100644
--- a/src/config.c
+++ b/src/config.c
@@ -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);
-- 
1.7.5.4

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

Reply via email to