From: Lennart Poettering Date: Tue, 9 Feb 2021 14:02:21 +0000 (+0100) Subject: format-table: don't hit assert if column got less width than it asked for X-Git-Tag: v248-rc1~176^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2cd9f773e29873df1b9f9b09c6c4f78853b16215;p=thirdparty%2Fsystemd.git format-table: don't hit assert if column got less width than it asked for If one field in a specific column has a maximum size limit, other fields in the same column might affected by it and get less than they asked for. Let's make sure we can handle this, and don't assert on this because surprisingly we got less than what we asked for. --- diff --git a/src/shared/format-table.c b/src/shared/format-table.c index 8b9c81664df..e3d8a051a22 100644 --- a/src/shared/format-table.c +++ b/src/shared/format-table.c @@ -1993,8 +1993,7 @@ int table_print(Table *t, FILE *f) { if (width[j] < minimum_width[j]) width[j] = minimum_width[j]; - assert(width[j] >= requested_width[j]); - delta = width[j] - requested_width[j]; + delta = LESS_BY(width[j], requested_width[j]); /* Subtract what we just added from the rest */ if (extra > delta)