45 lines
1.4 KiB
Diff
45 lines
1.4 KiB
Diff
diff -up rsyslog-7.2.1/runtime/msg.c.orig rsyslog-7.2.1/runtime/msg.c
|
|
--- rsyslog-7.2.1/runtime/msg.c.orig 2012-10-29 11:33:30.000000000 +0100
|
|
+++ rsyslog-7.2.1/runtime/msg.c 2012-11-14 08:58:20.235584832 +0100
|
|
@@ -3752,6 +3752,22 @@
|
|
RETiRet;
|
|
}
|
|
|
|
+static rsRetVal
|
|
+jsonMergeNonOverwrite(struct json_object *existing, struct json_object *json)
|
|
+{
|
|
+ DEFiRet;
|
|
+ struct json_object_iter it;
|
|
+
|
|
+ json_object_object_foreachC(existing, it) {
|
|
+ json_object_object_add(json, it.key, json_object_get(it.val));
|
|
+ }
|
|
+
|
|
+ CHKiRet(jsonMerge(existing, json));
|
|
+
|
|
+finalize_it:
|
|
+ RETiRet;
|
|
+}
|
|
+
|
|
/* find a JSON structure element (field or container doesn't matter). */
|
|
rsRetVal
|
|
jsonFind(msg_t *pM, es_str_t *propName, struct json_object **jsonres)
|
|
@@ -3795,7 +3811,7 @@
|
|
if(pM->json == NULL)
|
|
pM->json = json;
|
|
else
|
|
- CHKiRet(jsonMerge(pM->json, json));
|
|
+ CHKiRet(jsonMergeNonOverwrite(pM->json, json));
|
|
} else {
|
|
if(pM->json == NULL) {
|
|
/* now we need a root obj */
|
|
@@ -3808,7 +3824,7 @@
|
|
json_object_object_add(parent, (char*)leaf, json);
|
|
} else {
|
|
if(json_object_get_type(json) == json_type_object) {
|
|
- CHKiRet(jsonMerge(pM->json, json));
|
|
+ CHKiRet(jsonMergeNonOverwrite(pM->json, json));
|
|
} else {
|
|
//dbgprintf("AAAA: leafnode already exists, type is %d, update with %d\n", (int)json_object_get_type(leafnode), (int)json_object_get_type(json));
|
|
/* TODO: improve the code below, however, the current
|