gsize length;
char **groups;
char *str;
- gboolean protected;
+ gboolean protected, found = FALSE;
int i;
DBG("config %p", config);
- keyfile = __connman_storage_open_config(config->ident);
+ keyfile = __connman_storage_load_config(config->ident);
if (keyfile == NULL)
return -EIO;
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);
- __connman_storage_close_config(config->ident, keyfile, FALSE);
+ g_key_file_free(keyfile);
return 0;
}
{
struct connman_config *config;
const char *service_name;
- char *ident, *filename = NULL, *content = NULL;
+ char *ident, *content = NULL;
gsize content_length;
int err;
goto out;
}
- filename = g_strdup_printf("%s/%s.config", STORAGEDIR, ident);
- if (filename == NULL) {
- err = -ENOMEM;
- goto out;
- }
-
DBG("Saving %zu bytes to %s", content_length, service_name);
- if (g_file_set_contents(filename, content,
- content_length, NULL) == FALSE) {
- err = -EIO;
- goto out;
- }
+ __connman_storage_save_config(keyfile, ident);
return 0;
out:
g_free(ident);
g_free(content);
- g_free(filename);
return err;
}