summaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorAlok Barsode <alok.barsode@linux.intel.com>2011-08-24 16:53:18 +0300
committerSamuel Ortiz <sameo@linux.intel.com>2011-09-12 11:40:47 +0200
commit39245ddf5d1a220702a03683b78f1b868606c60a (patch)
tree2da72d498005064614ebbca4e87a2abc173cb97c /src/config.c
parentddc3e31dccabe5055225a73037ed2949a950ccac (diff)
downloadconnman-39245ddf5d1a220702a03683b78f1b868606c60a.tar.gz
connman-39245ddf5d1a220702a03683b78f1b868606c60a.tar.bz2
connman-39245ddf5d1a220702a03683b78f1b868606c60a.zip
storage: Switch to settings file
All the global settings would reside in /var/lib/connman/settings. We also migrate global keys from /var/lib/connman/default.profile to /var/lib/connman/settings for a smooth transition.
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/config.c b/src/config.c
index 90a2180b..db152283 100644
--- a/src/config.c
+++ b/src/config.c
@@ -383,7 +383,7 @@ static int load_config(struct connman_config *config)
DBG("config %p", config);
- keyfile = __connman_storage_open_config(config->ident);
+ keyfile = __connman_storage_load_config(config->ident);
if (keyfile == NULL)
return -EIO;
@@ -418,7 +418,7 @@ static int load_config(struct connman_config *config)
g_strfreev(groups);
- __connman_storage_close_config(config->ident, keyfile, FALSE);
+ g_key_file_free(keyfile);
return 0;
}
@@ -453,7 +453,7 @@ int __connman_config_load_service(GKeyFile *keyfile, const char *group,
{
struct connman_config *config;
const char *service_name;
- char *ident, *filename = NULL, *content = NULL;
+ char *ident, *content = NULL;
gsize content_length;
int err;
@@ -491,26 +491,15 @@ int __connman_config_load_service(GKeyFile *keyfile, const char *group,
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;
}