From: Theodore Ts'o Date: Sat, 11 Jan 2014 04:25:54 +0000 (-0500) Subject: blkid: fix blkid -o list formatting with columns > 160 X-Git-Tag: v1.42.9.wc1~101 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=2fc92dbc59eb4a7b7f28420b97086f320271dea2;p=tools%2Fe2fsprogs.git blkid: fix blkid -o list formatting with columns > 160 This bug is also in the util-linux version of blkid. Addresses-Coverity-Id: #1049158 Signed-off-by: "Theodore Ts'o" --- diff --git a/misc/blkid.c b/misc/blkid.c index 2e48caa..c40de98 100644 --- a/misc/blkid.c +++ b/misc/blkid.c @@ -142,20 +142,21 @@ static void pretty_print_line(const char *device, const char *fs_type, static int term_width = -1; int len, w; - if (term_width < 0) + if (term_width < 0) { term_width = get_terminal_width(); - if (term_width > 80) { - term_width -= 80; - w = term_width / 10; - if (w > 8) - w = 8; - term_width -= 2*w; - label_len += w; - fs_type_len += w; - w = term_width/2; - device_len += w; - mtpt_len +=w; + if (term_width > 80) { + term_width -= 80; + w = term_width / 10; + if (w > 8) + w = 8; + term_width -= 2*w; + label_len += w; + fs_type_len += w; + w = term_width/2; + device_len += w; + mtpt_len +=w; + } } len = pretty_print_word(device, device_len, 0, 1);