summaryrefslogtreecommitdiffstats
path: root/util/types.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-24 07:57:54 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-12-24 07:57:54 +0000
commit66e4b69042cd3b44acd42f1fad2109180c1bc48b (patch)
tree8bd8e664ae856167566375357963062e8112f181 /util/types.c
parentReleasing debian version 2.5-1. (diff)
downloadnvme-cli-66e4b69042cd3b44acd42f1fad2109180c1bc48b.tar.xz
nvme-cli-66e4b69042cd3b44acd42f1fad2109180c1bc48b.zip
Merging upstream version 2.7.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--util/types.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/util/types.c b/util/types.c
index 044391d..376c734 100644
--- a/util/types.c
+++ b/util/types.c
@@ -67,20 +67,21 @@ static char *__uint128_t_to_string(nvme_uint128_t val, bool l10n)
int idx = 60;
__u64 div, rem;
char *sep = NULL;
- int i, len = 0;
+ int i, len = 0, cl = 0;
if (l10n) {
sep = localeconv()->thousands_sep;
len = strlen(sep);
+ cl = 1;
}
/* terminate at the end, and build up from the ones */
str[--idx] = '\0';
do {
- if (len && !((sizeof(str) - idx) % (3 + len))) {
+ if (len && !((sizeof(str) - idx) % (3 + cl))) {
for (i = 0; i < len; i++)
- str[--idx] = sep[i];
+ str[--idx] = sep[len - i - 1];
}
rem = val.words[0];