summaryrefslogtreecommitdiffstats
path: root/sbin/mdconfig
diff options
context:
space:
mode:
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 107a259..ec667c5 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);
}
OpenPOWER on IntegriCloud