mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-24 23:00:07 +01:00
libnm/keyfile: don't parse JSON config in keyfile reader twice
Commit d6ec009afd ('team: normalize invalid configuration during
load') let's keyfile reader ignore JSON configs that cannot be parsed.
Keep doing that, but don't parse the JSON twice for that.
Just set the JSON, and if the setting afterwards does not verify, reset
it to NULL. We also get a better error message and in most cases we
don't need to parse twice.
This commit is contained in:
parent
74d0a5bf9a
commit
30455ab1b5
1 changed files with 5 additions and 5 deletions
|
|
@ -1619,16 +1619,16 @@ team_config_parser (KeyfileReaderInfo *info, NMSetting *setting, const char *key
|
|||
gs_free_error GError *error = NULL;
|
||||
|
||||
conf = nm_keyfile_plugin_kf_get_string (info->keyfile, setting_name, key, NULL);
|
||||
|
||||
g_object_set (G_OBJECT (setting), key, conf, NULL);
|
||||
|
||||
if ( conf
|
||||
&& conf[0]
|
||||
&& !nm_utils_is_json_object (conf, &error)) {
|
||||
&& !nm_setting_verify (setting, NULL, &error)) {
|
||||
handle_warn (info, key, NM_KEYFILE_WARN_SEVERITY_WARN,
|
||||
_("ignoring invalid team configuration: %s"),
|
||||
error->message);
|
||||
g_clear_pointer (&conf, g_free);
|
||||
g_object_set (G_OBJECT (setting), key, NULL, NULL);
|
||||
}
|
||||
|
||||
g_object_set (G_OBJECT (setting), key, conf, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue