diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-03-31 08:57:28 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-04-05 00:42:01 -0400 |
commit | 0ade5ffe2778e7b238bba8d979ca4d53dee1e702 (patch) | |
tree | 462058f4b647ee6f31b4d9b19e6777ef85ff587e /src/shared/logs-show.c | |
parent | a36b8debe67f3a5515200dada75cf4dbc334c7f5 (diff) |
journal: fix export of messages containing newlines
In "export" format, newlines are significant, and messages containing
newlines must be exported as "binary".
Diffstat (limited to 'src/shared/logs-show.c')
-rw-r--r-- | src/shared/logs-show.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 9d14933bc1..b0b66f64fc 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -547,7 +547,9 @@ static int output_export( startswith(data, "_BOOT_ID=")) continue; - if (!utf8_is_printable(data, length)) { + if (utf8_is_printable_newline(data, length, false)) + fwrite(data, length, 1, f); + else { const char *c; uint64_t le64; @@ -562,8 +564,7 @@ static int output_export( le64 = htole64(length - (c - (const char*) data) - 1); fwrite(&le64, sizeof(le64), 1, f); fwrite(c + 1, length - (c - (const char*) data) - 1, 1, f); - } else - fwrite(data, length, 1, f); + } fputc('\n', f); } |