summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-07-19 14:27:05 +0200
committerLennart Poettering <lennart@poettering.net>2016-07-19 17:51:20 +0200
commit0d23bc57da6a3aeb1e7f92cfd7da2cd831b7c11c (patch)
treecae77d07c8dfd6680e519300004a96f81bbf285e /src
parent4c5db93f8a3fe5f332f07af0cf5d17260cb0e861 (diff)
sd-journal: suppress empty lines
Let's make sure our logging APIs is in sync with how stdout/stderr logging works.
Diffstat (limited to 'src')
-rw-r--r--src/journal/journal-send.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
index 1b92585488..440fba67ca 100644
--- a/src/journal/journal-send.c
+++ b/src/journal/journal-send.c
@@ -110,6 +110,10 @@ _public_ int sd_journal_printv(int priority, const char *format, va_list ap) {
/* Strip trailing whitespace, keep prefix whitespace. */
(void) strstrip(buffer);
+ /* Suppress empty lines */
+ if (isempty(buffer+8))
+ return 0;
+
zero(iov);
IOVEC_SET_STRING(iov[0], buffer);
IOVEC_SET_STRING(iov[1], p);
@@ -476,7 +480,12 @@ _public_ int sd_journal_printv_with_location(int priority, const char *file, con
memcpy(buffer, "MESSAGE=", 8);
vsnprintf(buffer+8, sizeof(buffer) - 8, format, ap);
- (void) strstrip(buffer); /* strip trailing whitespace, keep prefixing whitespace */
+ /* Strip trailing whitespace, keep prefixing whitespace */
+ (void) strstrip(buffer);
+
+ /* Suppress empty lines */
+ if (isempty(buffer+8))
+ return 0;
/* func is initialized from __func__ which is not a macro, but
* a static const char[], hence cannot easily be prefixed with