svn commit: r203348 - stable/8/sbin/mdconfig

Jaakko Heinonen jh at FreeBSD.org
Mon Feb 1 16:02:15 UTC 2010


Author: jh
Date: Mon Feb  1 16:02:14 2010
New Revision: 203348
URL: http://svn.freebsd.org/changeset/base/203348

Log:
  MFC r202573:
  
  Print sizes up to INT64_MAX in md_prthumanval().
  
  PR:		bin/125365
  Approved by:	trasz (mentor)

Modified:
  stable/8/sbin/mdconfig/mdconfig.c
Directory Properties:
  stable/8/sbin/mdconfig/   (props changed)

Modified: stable/8/sbin/mdconfig/mdconfig.c
==============================================================================
--- stable/8/sbin/mdconfig/mdconfig.c	Mon Feb  1 15:22:22 2010	(r203347)
+++ stable/8/sbin/mdconfig/mdconfig.c	Mon Feb  1 16:02:14 2010	(r203348)
@@ -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