diff options
-rw-r--r-- | doc/config-format.txt | 4 | ||||
-rw-r--r-- | src/config.c | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/doc/config-format.txt b/doc/config-format.txt index 7f23c76f..cf89c09c 100644 --- a/doc/config-format.txt +++ b/doc/config-format.txt @@ -17,8 +17,8 @@ The 2 allowed fields for that entry are: - Name: Name of the network. - Description: Description of the network. - Protected: Configuration protection against being removed, modified or -overwritten by a Manager.ProvisionService() call. By default, a configuration -is not protected. +overwritten by a Manager.ProvisionService() call. If unset, this value defaults +to TRUE, i.e. configs are protected by default. Service entry [service_*] diff --git a/src/config.c b/src/config.c index a0872f71..53f9ad0e 100644 --- a/src/config.c +++ b/src/config.c @@ -373,6 +373,7 @@ err: static int load_config(struct connman_config *config) { GKeyFile *keyfile; + GError *error = NULL; gsize length; char **groups; char *str; @@ -401,8 +402,11 @@ static int load_config(struct connman_config *config) } protected = g_key_file_get_boolean(keyfile, "global", - CONFIG_KEY_PROT, NULL); - config->protected = protected; + CONFIG_KEY_PROT, &error); + if (error == NULL) + config->protected = protected; + else + config->protected = TRUE; groups = g_key_file_get_groups(keyfile, &length); @@ -478,6 +482,7 @@ int __connman_config_load_service(GKeyFile *keyfile, const char *group, service_name); g_key_file_set_string(keyfile, "global", CONFIG_KEY_DESC, "Internal Config File"); + g_key_file_set_boolean(keyfile, "global", CONFIG_KEY_PROT, FALSE); content = g_key_file_to_data(keyfile, &content_length, NULL); if (content == NULL) { |