svn commit: r202573 - head/sbin/mdconfig
Jaakko Heinonen
jh at FreeBSD.org
Mon Jan 18 14:07:41 UTC 2010
Author: jh
Date: Mon Jan 18 14:07:41 2010
New Revision: 202573
URL: http://svn.freebsd.org/changeset/base/202573
Log:
Print sizes up to INT64_MAX in md_prthumanval().
PR: bin/125365
Approved by: trasz (mentor)
MFC after: 2 weeks
Modified:
head/sbin/mdconfig/mdconfig.c
Modified: head/sbin/mdconfig/mdconfig.c
==============================================================================
--- head/sbin/mdconfig/mdconfig.c Mon Jan 18 13:44:44 2010 (r202572)
+++ head/sbin/mdconfig/mdconfig.c Mon Jan 18 14:07:41 2010 (r202573)
@@ -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);
}
More information about the svn-src-all
mailing list