From 66e4b69042cd3b44acd42f1fad2109180c1bc48b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 24 Dec 2023 08:57:54 +0100 Subject: Merging upstream version 2.7.1. Signed-off-by: Daniel Baumann --- util/types.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'util/types.c') 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]; -- cgit v1.2.3