diff options
| author | Gergely Nagy <algernon@balabit.hu> | 2012-04-20 12:37:35 +0200 |
|---|---|---|
| committer | Gergely Nagy <algernon@balabit.hu> | 2012-04-20 12:37:35 +0200 |
| commit | 32887a13759b27f5b29f585d2b278c225be1fa0d (patch) | |
| tree | 70672dd48bf2a0cea5f4d1dd8c9effe9e9850160 | |
| parent | 71b8240a9768cdecef3e8a27fd84fecef8e6de40 (diff) | |
| download | libumberlog-32887a13759b27f5b29f585d2b278c225be1fa0d.tar.gz libumberlog-32887a13759b27f5b29f585d2b278c225be1fa0d.tar.xz libumberlog-32887a13759b27f5b29f585d2b278c225be1fa0d.zip | |
Properly reset the JSON buffer in all cases.
Previously the JSON buffer was only reset when ul_vformat() was
called, but not everything goes through that, so some messages ended
up being garbled.
The proper thing to do is to reset in _ul_vformat(), as everything
goes through that, and that's the right place to do this anyway.
Reported-by: Peter Czanik <czanik@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
| -rw-r--r-- | lib/umberlog.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/umberlog.c b/lib/umberlog.c index 84bd64b..d07a24a 100644 --- a/lib/umberlog.c +++ b/lib/umberlog.c @@ -348,6 +348,8 @@ _ul_vformat (ul_buffer_t *buffer, int format_version, if (!value) return NULL; + ul_buffer_reset (buffer); + buffer = ul_buffer_append (buffer, "msg", value); if (buffer == NULL) { @@ -402,8 +404,6 @@ ul_vformat (int priority, const char *msg_format, va_list ap) const char *msg; ul_buffer_t *buffer = &ul_buffer; - ul_buffer_reset (buffer); - msg = _ul_vformat_str (buffer, 1, priority, msg_format, ap); if (!msg) { |
