chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
3ed08c4
)
journal-send: always send SYSLOG_IDENTIFIER, if we have it
author
Lennart Poettering
<lennart@poettering.net>
Tue, 20 Nov 2012 20:25:26 +0000
(21:25 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Tue, 20 Nov 2012 20:39:16 +0000
(21:39 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=872193
src/journal/journal-send.c
patch
|
blob
|
history
diff --git
a/src/journal/journal-send.c
b/src/journal/journal-send.c
index 7a91569055ef27dc3261d14c4d1f4ee10fdadf7a..bd8f8872c9d54cf0050664e5a22ad3cd989637f0 100644
(file)
--- 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";
* 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;
if (_unlikely_(!iov))
return -EINVAL;
@@
-228,7
+229,7
@@
_public_ int sd_journal_sendv(const struct iovec *iov, int n) {
saved_errno = errno;
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++) {
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;
}
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)) {
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");
}
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;
fd = journal_fd();
if (_unlikely_(fd < 0)) {
r = fd;