mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-29 16:44:03 +00:00
Print sizes up to INT64_MAX in md_prthumanval().
PR: bin/125365 Approved by: trasz (mentor) MFC after: 2 weeks
This commit is contained in:
parent
b9a74f2ad5
commit
0e3ebc63e6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=202573
@ -454,14 +454,15 @@ static void
|
||||
md_prthumanval(char *length)
|
||||
{
|
||||
char buf[6];
|
||||
uint64_t bytes;
|
||||
uintmax_t bytes;
|
||||
char *endptr;
|
||||
|
||||
bytes = strtoul(length, &endptr, 10);
|
||||
if (bytes == (unsigned)ULONG_MAX || *endptr != '\0')
|
||||
errno = 0;
|
||||
bytes = strtoumax(length, &endptr, 10);
|
||||
if (errno != 0 || *endptr != '\0' || bytes > INT64_MAX)
|
||||
return;
|
||||
humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1),
|
||||
bytes, "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
|
||||
humanize_number(buf, sizeof(buf), (int64_t)bytes, "",
|
||||
HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
|
||||
(void)printf("%6s", buf);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user