summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-05 15:02:38 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-05 15:02:38 +0100
commitfc7b7e2e74ed0c4ce2bda91d693240c9dcd0d526 (patch)
treeff38ab7fef16da6d7cfa73cf51ed74aa1e9eed13
parentjournald: drop splitting-by-audit entirely (diff)
downloadsystemd-fc7b7e2e74ed0c4ce2bda91d693240c9dcd0d526.tar.xz
systemd-fc7b7e2e74ed0c4ce2bda91d693240c9dcd0d526.zip
journald: stpcpy() + mempcpy() are awesome
-rw-r--r--src/journal/journald-server.c5
1 files changed, 1 insertions, 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);
}
}