summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-02-09 15:02:21 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-03-12 18:13:28 +0100
commit79df3db482cff975f7de1d740df115ffd844511e (patch)
tree1f2befa092e46d1979eef9d902f2441297f8e72a
parent2b59084fd405cdab82e4296401f227f14657554c (diff)
downloadsystemd-79df3db482cff975f7de1d740df115ffd844511e.tar.gz
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. (cherry picked from commit 2cd9f773e29873df1b9f9b09c6c4f78853b16215) (cherry picked from commit db3aaa0a661c993994194a60f1a24a1495496bab)
-rw-r--r--src/shared/format-table.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/shared/format-table.c b/src/shared/format-table.c
index 612402cbc1..55a7c774a1 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)