systemd/journal-send-always-send-syslog_identifier.patch
Robert Milasan b8b836245b Accepting request 149703 from home:fcrozat:branches:Base:System
- Add systemctl-options.patch: handle SYSTEMCTL_OPTIONS internaly
  (bnc#798620).
- Update crypt-loop-file.patch to correctly detect crypto loop
  files (bnc#799514).
- Add journalctl-remove-leftover-message.patch: remove debug
  message in systemctl.
- Add job-avoid-recursion-when-cancelling.patch: prevent potential
  recursion when cancelling a service.
- Add sysctl-parse-all-keys.patch: ensure sysctl file is fully
  parsed.
- Add journal-fix-cutoff-max-date.patch: fix computation of cutoff
  max date for journal.
- Add reword-rescue-mode-hints.patch: reword rescue prompt.
- Add improve-overflow-checks.patch: improve time overflow checks.
- Add fix-swap-behaviour-with-symlinks.patch: fix swap behaviour
  with symlinks.
- Add hostnamectl-fix-set-hostname-with-no-argument.patch: ensure
  hostnamectl requires an argument when called with set-hostname
  option.
- Add agetty-overrides-term.patch: pass correctly terminal type to
  agetty.
- Add check-for-empty-strings-in-strto-conversions.patch: better
  check for empty strings in strto* conversions.
- Add strv-cleanup-error-path-loops.patch: cleanup strv on error
  path.
- Add cryptsetup-handle-plain.patch: correctly handle "plain"
  option in cryptsetup.
- Add fstab-generator-improve-error-message.patch: improve error
  message in fstab-generator.
- Add delta-accept-t-option.patch: accept -t option in

OBS-URL: https://build.opensuse.org/request/show/149703
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=331
2013-01-23 13:44:07 +00:00

66 lines
2.5 KiB
Diff

From ee55db41442ad8055f5a84a339b1e0e22bc037c4 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 20 Nov 2012 21:25:26 +0100
Subject: [PATCH] journal-send: always send SYSLOG_IDENTIFIER, if we have it
https://bugzilla.redhat.com/show_bug.cgi?id=872193
---
src/journal/journal-send.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
index 7a91569..bd8f887 100644
--- a/src/journal/journal-send.c
+++ b/src/journal/journal-send.c
@@ -219,6 +219,7 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
* be a tmpfs, and one that is available from early boot on
* and where unprivileged users can create files. */
char path[] = "/dev/shm/journal.XXXXXX";
+ bool have_syslog_identifier = false;
if (_unlikely_(!iov))
return -EINVAL;
@@ -228,7 +229,7 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
saved_errno = errno;
- w = alloca(sizeof(struct iovec) * n * 5);
+ w = alloca(sizeof(struct iovec) * n * 5 + 3);
l = alloca(sizeof(uint64_t) * n);
for (i = 0; i < n; i++) {
@@ -245,6 +246,9 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
goto finish;
}
+ have_syslog_identifier =
+ have_syslog_identifier || (c == iov[i].iov_base + 17 && memcmp(iov[i].iov_base, "SYSLOG_IDENTIFIER", 17) == 0);
+
nl = memchr(iov[i].iov_base, '\n', iov[i].iov_len);
if (nl) {
if (_unlikely_(nl < c)) {
@@ -280,6 +284,20 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
IOVEC_SET_STRING(w[j++], "\n");
}
+ if (!have_syslog_identifier &&
+ string_is_safe(program_invocation_short_name)) {
+
+ /* Implicitly add program_invocation_short_name, if it
+ * is not set explicitly. We only do this for
+ * program_invocation_short_name, and nothing else
+ * since everything else is much nicer to retrieve
+ * from the outside. */
+
+ IOVEC_SET_STRING(w[j++], "SYSLOG_IDENTIFIER=");
+ IOVEC_SET_STRING(w[j++], program_invocation_short_name);
+ IOVEC_SET_STRING(w[j++], "\n");
+ }
+
fd = journal_fd();
if (_unlikely_(fd < 0)) {
r = fd;
--
1.7.10.4