aboutsummaryrefslogtreecommitdiff
path: root/sbin/mdconfig
diff options
context:
space:
mode:
authorJaakko Heinonen <jh@FreeBSD.org>2010-01-18 14:07:41 +0000
committerJaakko Heinonen <jh@FreeBSD.org>2010-01-18 14:07:41 +0000
commit0e3ebc63e6f3c814bf732e01a867c8640c67998e (patch)
treefb49fbc6e1f99ded2ac82f5df8f485a912336343 /sbin/mdconfig
parentb9a74f2ad5ee267c7da2476738ba553a571ca67d (diff)
downloadsrc-0e3ebc63e6f3c814bf732e01a867c8640c67998e.tar.gz
src-0e3ebc63e6f3c814bf732e01a867c8640c67998e.zip
Print sizes up to INT64_MAX in md_prthumanval().
PR: bin/125365 Approved by: trasz (mentor) MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=202573
Diffstat (limited to 'sbin/mdconfig')
-rw-r--r--sbin/mdconfig/mdconfig.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c
index 107a25975097..ec667c51ad52 100644
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
@@ -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);
}