diff options
author | Thomas Haller <thaller@redhat.com> | 2019-06-09 13:36:39 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-06-09 13:40:28 +0200 |
commit | 2d6c711d6429f27489ca4f242a7827d7a9a98c33 (patch) | |
tree | fadd863398c693aa2dc9b0989ee1a6fca430aab5 | |
parent | dd3b47deed0f17903290bb4503a82818ad17634e (diff) | |
download | NetworkManager-2d6c711d6429f27489ca4f242a7827d7a9a98c33.tar.gz |
libnm/team: fix setting setting same JSON string
When we set the same JSON config twice in a row, the second time has
indeed no effect and we can just return right away (indicating that
no attributes changed).
However, that is not true, if we are in strict validating mode and
the JSON string just happens to be the same. In this case, we still
want to switch from strict validating mode to relaxed mode. Hence,
we should not return early but continue setting the property.
-rw-r--r-- | libnm-core/nm-team-utils.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libnm-core/nm-team-utils.c b/libnm-core/nm-team-utils.c index 7346c1d03e..dd67efae8c 100644 --- a/libnm-core/nm-team-utils.c +++ b/libnm-core/nm-team-utils.c @@ -1872,13 +1872,16 @@ nm_team_setting_config_set (NMTeamSetting *self, const char *js_str) } if ( self->d._js_str - && nm_streq (js_str, self->d._js_str)) - return 0; - - changed_flags |= nm_team_attribute_to_flags (NM_TEAM_ATTRIBUTE_CONFIG); + && nm_streq (js_str, self->d._js_str)) { + if (!self->d.strict_validated) { + /* setting the same JSON string twice in a row has no effect. */ + return 0; + } + } else + changed_flags |= nm_team_attribute_to_flags (NM_TEAM_ATTRIBUTE_CONFIG); #if WITH_JSON_VALIDATION - if (js_str[0] != '\0') { + { nm_auto_decref_json json_t *root_js_obj = NULL; if (nm_jansson_load ()) |