summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-11-25 14:11:00 +0100
committerThomas Haller <thaller@redhat.com>2016-11-25 18:02:38 +0100
commit03f35e96de2a33fc1756d4404a42b51464d3f953 (patch)
tree63d8c43817c2c9d6da01e484af52eac18dca063e
parent6689d0bf7184b22b01550e1db997e93d089cf99d (diff)
downloadNetworkManager-03f35e96de2a33fc1756d4404a42b51464d3f953.tar.gz
config: fix config merging default value for main.plugins
Since commit fb2ca0ce3d we would no longer pre-set the main.plugins value in NMConfig's keyfile to recognize unset default settings. This breaks with [main] plugins+=foo which now results in main.plgin=foo while previously it would have extended the compile time default. https://bugzilla.redhat.com/show_bug.cgi?id=1397938 Fixes: fb2ca0ce3dadae8154d2ad8b611538323be137ac
-rw-r--r--src/nm-config.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nm-config.c b/src/nm-config.c
index 1095b901f3..03aa6d4b64 100644
--- a/src/nm-config.c
+++ b/src/nm-config.c
@@ -755,6 +755,13 @@ read_config (GKeyFile *keyfile, gboolean is_base_config, const char *dirname, co
if (is_string_list) {
old_val = g_key_file_get_string_list (keyfile, group, base_key, NULL, NULL);
new_val = g_key_file_get_string_list (kf, group, key, NULL, NULL);
+ if (!old_val && !g_key_file_has_key (keyfile, group, base_key, NULL)) {
+ /* we must fill the unspecified value with the compile-time default. */
+ if (nm_streq (group, NM_CONFIG_KEYFILE_GROUP_MAIN) && nm_streq (base_key, "plugins")) {
+ g_key_file_set_value (keyfile, group, base_key, NM_CONFIG_PLUGINS_DEFAULT);
+ old_val = g_key_file_get_string_list (keyfile, group, base_key, NULL, NULL);
+ }
+ }
} else {
gs_free char *old_sval = nm_config_keyfile_get_value (keyfile, group, base_key, NM_CONFIG_GET_VALUE_TYPE_SPEC);
gs_free char *new_sval = nm_config_keyfile_get_value (kf, group, key, NM_CONFIG_GET_VALUE_TYPE_SPEC);