From 25b3245fb483e52766867dfe33ce271011caaca9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 4 Nov 2014 01:00:50 +0100 Subject: [PATCH] journald: include audit message type number in MESSAGE= string --- src/journal/journald-audit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c index 76f6f3f..f543732 100644 --- a/src/journal/journald-audit.c +++ b/src/journal/journald-audit.c @@ -345,7 +345,7 @@ static void process_audit_string(Server *s, int type, const char *data, size_t s char id_field[sizeof("_AUDIT_ID=") + DECIMAL_STR_MAX(uint64_t)], type_field[sizeof("_AUDIT_TYPE=") + DECIMAL_STR_MAX(int)], source_time_field[sizeof("_SOURCE_REALTIME_TIMESTAMP=") + DECIMAL_STR_MAX(usec_t)]; - const char *m; + char *m; assert(s); @@ -396,7 +396,8 @@ static void process_audit_string(Server *s, int type, const char *data, size_t s sprintf(id_field, "_AUDIT_ID=%" PRIu64, id); IOVEC_SET_STRING(iov[n_iov++], id_field); - m = strappenda("MESSAGE=audit: ", p); + m = alloca(strlen("MESSAGE=audit-") + DECIMAL_STR_MAX(int) + strlen(": ") + strlen(p) + 1); + sprintf(m, "MESSAGE=audit-%i: %s", type, p); IOVEC_SET_STRING(iov[n_iov++], m); z = n_iov; -- 2.7.4