From 2fc92dbc59eb4a7b7f28420b97086f320271dea2 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 10 Jan 2014 23:25:54 -0500 Subject: [PATCH] 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" --- misc/blkid.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) 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); -- 1.8.3.1