Blame rsyslog-8.8.0-immutable-json-props.patch
|
Tomas Heinrich |
4c244e0 |
diff -up ./runtime/msg.c.orig ./runtime/msg.c
|
|
Tomas Heinrich |
4c244e0 |
--- a/runtime/msg.c 2015-01-15 19:30:02.351699869 +0100
|
|
Tomas Heinrich |
4c244e0 |
+++ b/runtime/msg.c 2015-01-15 19:35:58.667176642 +0100
|
|
Tomas Heinrich |
4c244e0 |
@@ -4267,22 +4267,19 @@ jsonPathFindParent(struct json_object *j
|
|
Tomas Heinrich |
4c244e0 |
RETiRet;
|
|
Tomas Heinrich |
4c244e0 |
}
|
|
Tomas Heinrich |
4c244e0 |
|
|
Tomas Heinrich |
4c244e0 |
+/* In case of duplicate names, the original value is kept. */
|
|
Tomas Heinrich |
4c244e0 |
static rsRetVal
|
|
Tomas Heinrich |
4c244e0 |
jsonMerge(struct json_object *existing, struct json_object *json)
|
|
Tomas Heinrich |
4c244e0 |
{
|
|
Tomas Heinrich |
4c244e0 |
- /* TODO: check & handle duplicate names */
|
|
Tomas Heinrich |
4c244e0 |
DEFiRet;
|
|
Tomas Heinrich |
4c244e0 |
struct json_object_iter it;
|
|
Tomas Heinrich |
4c244e0 |
|
|
Tomas Heinrich |
4c244e0 |
- json_object_object_foreachC(json, it) {
|
|
Tomas Heinrich |
4c244e0 |
- json_object_object_add(existing, it.key,
|
|
Tomas Heinrich |
4c244e0 |
- json_object_get(it.val));
|
|
Tomas Heinrich |
4c244e0 |
+ json_object_object_foreachC(existing, it) {
|
|
Tomas Heinrich |
4c244e0 |
+ json_object_object_add(json, it.key, json_object_get(it.val));
|
|
Tomas Heinrich |
4c244e0 |
}
|
|
Tomas Heinrich |
4c244e0 |
- /* note: json-c does ref counting. We added all descandants refcounts
|
|
Tomas Heinrich |
4c244e0 |
- * in the loop above. So when we now free(_put) the root object, only
|
|
Tomas Heinrich |
4c244e0 |
- * root gets freed().
|
|
Tomas Heinrich |
4c244e0 |
- */
|
|
Tomas Heinrich |
4c244e0 |
- json_object_put(json);
|
|
Tomas Heinrich |
4c244e0 |
+
|
|
Tomas Heinrich |
4c244e0 |
+ iRet = jsonMerge(existing, json);
|
|
Tomas Heinrich |
4c244e0 |
+
|
|
Tomas Heinrich |
4c244e0 |
RETiRet;
|
|
Tomas Heinrich |
4c244e0 |
}
|
|
Tomas Heinrich |
4c244e0 |
|