From 07c289875fd46331a430c43e8991d3c7407cb703 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 3 Oct 2012 11:50:45 -0400 Subject: journal-send: simplification --- src/journal/journal-send.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/journal') diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c index d503f3f428..8589d94479 100644 --- a/src/journal/journal-send.c +++ b/src/journal/journal-send.c @@ -505,10 +505,10 @@ _public_ int sd_journal_printv_with_location(int priority, const char *file, con /* func is initialized from __func__ which is not a macro, but * a static const char[], hence cannot easily be prefixed with * CODE_FUNC=, hence let's do it manually here. */ - fl = strlen(func); + fl = strlen(func) + 1; f = alloca(fl + 10); memcpy(f, "CODE_FUNC=", 10); - memcpy(f + 10, func, fl + 1); + memcpy(f + 10, func, fl); zero(iov); IOVEC_SET_STRING(iov[0], buffer); @@ -536,10 +536,10 @@ _public_ int sd_journal_send_with_location(const char *file, const char *line, c goto finish; } - fl = strlen(func); + fl = strlen(func) + 1; f = alloca(fl + 10); memcpy(f, "CODE_FUNC=", 10); - memcpy(f + 10, func, fl + 1); + memcpy(f + 10, func, fl); IOVEC_SET_STRING(iov[0], file); IOVEC_SET_STRING(iov[1], line); @@ -574,10 +574,10 @@ _public_ int sd_journal_sendv_with_location( niov = alloca(sizeof(struct iovec) * (n + 3)); memcpy(niov, iov, sizeof(struct iovec) * n); - fl = strlen(func); + fl = strlen(func) + 1; f = alloca(fl + 10); memcpy(f, "CODE_FUNC=", 10); - memcpy(f + 10, func, fl + 1); + memcpy(f + 10, func, fl); IOVEC_SET_STRING(niov[n++], file); IOVEC_SET_STRING(niov[n++], line); @@ -595,10 +595,10 @@ _public_ int sd_journal_perror_with_location( size_t fl; char *f; - fl = strlen(func); + fl = strlen(func) + 1; f = alloca(fl + 10); memcpy(f, "CODE_FUNC=", 10); - memcpy(f + 10, func, fl + 1); + memcpy(f + 10, func, fl); IOVEC_SET_STRING(iov[0], file); IOVEC_SET_STRING(iov[1], line); -- cgit v1.2.3-54-g00ecf