[systemd-devel] [PATCH] logs-show: fix off-by-one error
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Fri Aug 3 09:12:55 PDT 2012
On 08/03/2012 04:28 AM, shawnlandden at gmail.com wrote:
> From: Shawn Landen <shawnlandden at gmail.com>
>
> Ellipsize lines that are one character too long.
> ---
> src/shared/logs-show.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
> index c72ebc1..b6e6a85 100644
> --- a/src/shared/logs-show.c
> +++ b/src/shared/logs-show.c
> @@ -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;
Thanks. Applied.
Zbyszek
More information about the systemd-devel
mailing list