diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2012-04-27 16:01:50 +0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-04-27 15:14:16 +0200 |
commit | 9448c0e72f8d3187ae7dcedcad35313acbe95f09 (patch) | |
tree | 52fc99059eaa72f6311117278cb1d90bd5475867 /src/storage.c | |
parent | f4ad9eab7c0f88a92c980a30315fd20a6ac0f256 (diff) | |
download | connman-9448c0e72f8d3187ae7dcedcad35313acbe95f09.tar.gz connman-9448c0e72f8d3187ae7dcedcad35313acbe95f09.tar.bz2 connman-9448c0e72f8d3187ae7dcedcad35313acbe95f09.zip |
storage: Create settings file only when migrating
The settings file is created only when migrating
from default.profile. This means that technology
default values are used if settings file does not
exists.
Diffstat (limited to 'src/storage.c')
-rw-r--r-- | src/storage.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/src/storage.c b/src/storage.c index 75a1b0b8..d01b77e0 100644 --- a/src/storage.c +++ b/src/storage.c @@ -400,32 +400,13 @@ void __connman_storage_migrate() if(pathname == NULL) return; - /* Copy global settings from default.profile to settings. */ - keyfile = g_key_file_new(); - - /* If default.profile doesn't exists, create settings with defaults. */ + /* If default.profile exists, create new settings file */ keyfile_def = storage_load(pathname); - if (keyfile_def == NULL) { - g_key_file_set_boolean(keyfile, "global", - "OfflineMode", FALSE); - - g_key_file_set_boolean(keyfile, "WiFi", - "Enable", FALSE); - - g_key_file_set_boolean(keyfile, "Bluetooth", - "Enable", FALSE); - - g_key_file_set_boolean(keyfile, "Wired", - "Enable", FALSE); - - g_key_file_set_boolean(keyfile, "Cellular", - "Enable", FALSE); - - g_key_file_set_boolean(keyfile, "WiMAX", - "Enable", FALSE); - + if (keyfile_def == NULL) goto done; - } + + /* Copy global settings from default.profile to settings. */ + keyfile = g_key_file_new(); val = g_key_file_get_boolean(keyfile_def, "global", "OfflineMode", &error); @@ -487,13 +468,12 @@ void __connman_storage_migrate() g_key_file_set_boolean(keyfile, "WiMAX", "Enable", val); -done: __connman_storage_save_global(keyfile); g_key_file_free(keyfile); - if (keyfile_def) - g_key_file_free(keyfile_def); + g_key_file_free(keyfile_def); +done: g_free(pathname); } |