Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Feb 2010 16:02:14 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r203348 - stable/8/sbin/mdconfig
Message-ID:  <201002011602.o11G2EGh003709@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002011602.o11G2EGh003709>