diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-10-27 15:52:37 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2019-10-30 10:50:34 +0100 |
commit | 445d3476a937ad34dfdc4057655798c4d28d9080 (patch) | |
tree | 9a5fc6c5b5aaf4cea414cc656cf64f322a348ba5 | |
parent | 939514fd39dcebbabf6a56f20d97e6c2bf8ba022 (diff) | |
download | ModemManager-445d3476a937ad34dfdc4057655798c4d28d9080.tar.gz |
cli,output: fix truncated array output when == 10 elements
The extra character size was only being applied when > 10 elements,
leaving the == 10 case out of it, so the output was being truncated.
Fix it, by using a more generic way to computing how many extra
characters we need in the size.
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/151
(cherry picked from commit f9ea0c1d9cfe6b57a556060b7d9374a64457d183)
-rw-r--r-- | cli/mmcli-output.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cli/mmcli-output.c b/cli/mmcli-output.c index 0242460cc..8e038595b 100644 --- a/cli/mmcli-output.c +++ b/cli/mmcli-output.c @@ -960,8 +960,10 @@ dump_output_keyvalue (void) n = multiple->values ? g_strv_length (multiple->values) : 0; if (n > 0) { + guint aux = n; + key_length += ((strlen (KEY_ARRAY_VALUE_SUFFIX)) + 3); - if (n > 10) + while ((aux /= 10) > 0) key_length++; } } |