From fc7b7e2e74ed0c4ce2bda91d693240c9dcd0d526 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 5 Mar 2013 15:02:38 +0100 Subject: journald: stpcpy() + mempcpy() are awesome --- src/journal/journald-server.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index c1ec0fad32..654f7ace21 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -620,9 +620,7 @@ static void dispatch_message_real( if (label) { selinux_context = malloc(sizeof("_SELINUX_CONTEXT=") + label_len); if (selinux_context) { - memcpy(selinux_context, "_SELINUX_CONTEXT=", sizeof("_SELINUX_CONTEXT=")-1); - memcpy(selinux_context+sizeof("_SELINUX_CONTEXT=")-1, label, label_len); - selinux_context[sizeof("_SELINUX_CONTEXT=")-1+label_len] = 0; + *((char*) mempcpy(stpcpy(selinux_context, "_SELINUX_CONTEXT="), label, label_len)) = 0; IOVEC_SET_STRING(iovec[n++], selinux_context); } } else { @@ -632,7 +630,6 @@ static void dispatch_message_real( selinux_context = strappend("_SELINUX_CONTEXT=", con); if (selinux_context) IOVEC_SET_STRING(iovec[n++], selinux_context); - freecon(con); } } -- cgit v1.2.3-54-g00ecf