From 5e6f7de4be4a1b606d77b1766663fbfd9f40c6d7 Mon Sep 17 00:00:00 2001 From: Francesco Giudici Date: Wed, 15 Nov 2017 15:47:29 +0100 Subject: [PATCH] libnm-core: preserve keys order in team.config with old jansson libs When jansson lib version is < 2.8 the order of the keys of json objects is not preserved automatically. In particular, when loading the json string, parsing it and dumping it back to a string the key order will be lost if the now deprecated JSON_PRESERVE_ORDER flag is not set. Add the flag: will do nothing on recent jansson versions but will fix behavior for legacy ones. --- libnm-core/nm-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index bb91f93733..cac5c5e9b4 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -4696,7 +4696,7 @@ _nm_utils_team_config_set (char **conf, done: if (updated) { g_free (*conf); - *conf = json_dumps (json, 0); + *conf = json_dumps (json, JSON_PRESERVE_ORDER); /* Don't save an empty config */ if (nm_streq0 (*conf, "{}")) { g_free (*conf);