This bug is also in the util-linux version of blkid.
Addresses-Coverity-Id: #
1049158
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
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);