From 9448c0e72f8d3187ae7dcedcad35313acbe95f09 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 27 Apr 2012 16:01:50 +0300 Subject: [PATCH] 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. --- src/storage.c | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/src/storage.c b/src/storage.c index 75a1b0b..d01b77e 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); } -- 2.7.4