summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-06-09 11:53:23 +0200
committerThomas Haller <thaller@redhat.com>2015-06-16 15:38:47 +0200
commit58ce5b4976b6aee60b36f29a672f632176f03f83 (patch)
tree09cf27378e554b6d4a5becc7c9192a0b93bc997f
parente88ab8bba383706e3c13efc29edc4d32df146f48 (diff)
downloadNetworkManager-58ce5b4976b6aee60b36f29a672f632176f03f83.tar.gz
config: don't log warning in nm_config_keyfile_get_boolean()
We don't want to log a warning every time we access a keyfile value. If we would like to warn about invalid values, we should do it once after the configuration is loaded. And then we should not only do it for booleans, but for other types as well. For now, just drop this.
-rw-r--r--src/nm-config.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/nm-config.c b/src/nm-config.c
index 4438fdfa7a..f0103971d9 100644
--- a/src/nm-config.c
+++ b/src/nm-config.c
@@ -161,26 +161,14 @@ nm_config_keyfile_get_boolean (GKeyFile *keyfile,
const char *key,
gint default_value)
{
- gint value = default_value;
- char *str;
+ gs_free char *str = NULL;
g_return_val_if_fail (keyfile != NULL, default_value);
g_return_val_if_fail (section != NULL, default_value);
g_return_val_if_fail (key != NULL, default_value);
str = g_key_file_get_value (keyfile, section, key, NULL);
- if (!str)
- return default_value;
-
- value = nm_config_parse_boolean (str, -1);
- if (value == -1) {
- nm_log_warn (LOGD_CORE, "Unrecognized value for %s.%s: '%s'. Assuming '%s'",
- section, key, str, default_value ? "true" : "false");
- value = default_value;
- }
-
- g_free (str);
- return value;
+ return nm_config_parse_boolean (str, default_value);
}
void