diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2019-10-27 15:52:37 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2019-10-27 15:57:30 +0100 |
commit | f9ea0c1d9cfe6b57a556060b7d9374a64457d183 (patch) | |
tree | b527997de6d0277c10d269833eedfbcfc5eca216 | |
parent | 1576c7d8009f4e1ca60004863b8a88b2105c103f (diff) |
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
-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 338e6589..c72af513 100644 --- a/cli/mmcli-output.c +++ b/cli/mmcli-output.c @@ -964,8 +964,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++; } } |