libsmartcols: check recount_widths() return value

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2014-05-06 10:21:24 +02:00
parent dc64469f4f
commit 140b006172
1 changed files with 5 additions and 1 deletions

View File

@ -738,14 +738,18 @@ int scols_print_table(struct libscols_table *tb)
if (!buf)
return -ENOMEM;
if (!(scols_table_is_raw(tb) || scols_table_is_export(tb)))
if (!(scols_table_is_raw(tb) || scols_table_is_export(tb))) {
rc = recount_widths(tb, buf);
if (rc != 0)
goto done;
}
if (scols_table_is_tree(tb))
rc = print_tree(tb, buf);
else
rc = print_table(tb, buf);
done:
free_buffer(buf);
return rc;
}