journalctl: make sure that journalctl's --all switch also has an effect on json output
authorLennart Poettering <lennart@poettering.net>
Fri, 1 Jul 2016 00:41:19 +0000 (17:41 -0700)
committerLennart Poettering <lennart@poettering.net>
Tue, 19 Jul 2016 12:21:49 +0000 (14:21 +0200)
With this change, binary record data is formatted as string if --all is
specified when using json output. This is inline with the effect of --all on
the other available output modes.

Fixes: #3416

src/shared/logs-show.c

index 9351b85..d04728f 100644 (file)
@@ -489,7 +489,7 @@ static int output_verbose(
                         off = ANSI_NORMAL;
                 }
 
-                if (flags & OUTPUT_SHOW_ALL ||
+                if ((flags & OUTPUT_SHOW_ALL) ||
                     (((length < PRINT_CHAR_THRESHOLD) || flags & OUTPUT_FULL_WIDTH)
                      && utf8_is_printable(data, length))) {
                         fprintf(f, "    %s%.*s=", on, fieldlen, (const char*)data);
@@ -607,7 +607,7 @@ void json_escape(
         if (!(flags & OUTPUT_SHOW_ALL) && l >= JSON_THRESHOLD)
                 fputs("null", f);
 
-        else if (!utf8_is_printable(p, l)) {
+        else if (!(flags & OUTPUT_SHOW_ALL) && !utf8_is_printable(p, l)) {
                 bool not_first = false;
 
                 fputs("[ ", f);