chiark / gitweb /
logs-show: fix off-by-one error
authorShawn Landen <shawnlandden@gmail.com>
Fri, 3 Aug 2012 02:28:28 +0000 (02:28 +0000)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 3 Aug 2012 16:12:07 +0000 (18:12 +0200)
Ellipsize lines that are one character too long.

src/shared/logs-show.c

index c72ebc11f57c1644ec777249299b5d31c0fba737..b6e6a85819882c06c65be4b3279df1e65e578feb 100644 (file)
@@ -246,7 +246,7 @@ static int output_short(sd_journal *j, unsigned line, unsigned n_columns,
                 char bytes[FORMAT_BYTES_MAX];
                 printf(": [%s blob data]\n", format_bytes(bytes, sizeof(bytes), message_len));
         } else if ((flags & OUTPUT_FULL_WIDTH) ||
-                   (message_len + n < n_columns))
+                   (message_len + n + 1 < n_columns))
                 printf(": %s%.*s%s\n", color_on, (int) message_len, message, color_off);
         else if (n < n_columns && n_columns - n - 2 >= 3) {
                 char *e;