svn commit: r225007 - head/sbin/fdisk

Andrey V. Elsukov ae at FreeBSD.org
Fri Aug 19 12:48:07 UTC 2011


Author: ae
Date: Fri Aug 19 12:48:06 2011
New Revision: 225007
URL: http://svn.freebsd.org/changeset/base/225007

Log:
  The decimal() function was changed in r217808 to take the
  maximum value instead of number of bits. But for case when
  limitation is not needed it erroneously skips conversion to
  number and always returns zero. So, don't skip conversion
  for case when limitation is not needed.
  
  PR:		bin/159765
  Approved by:	re (kib)

Modified:
  head/sbin/fdisk/fdisk.c

Modified: head/sbin/fdisk/fdisk.c
==============================================================================
--- head/sbin/fdisk/fdisk.c	Fri Aug 19 12:08:54 2011	(r225006)
+++ head/sbin/fdisk/fdisk.c	Fri Aug 19 12:48:06 2011	(r225007)
@@ -940,7 +940,7 @@ decimal(const char *str, int *num, int d
 			return 0;
 		while ((c = *cp++)) {
 			if (c <= '9' && c >= '0') {
-				if (maxval > 0 && acc <= maxval)
+				if (acc <= maxval || maxval == 0)
 					acc = acc * 10 + c - '0';
 			} else
 				break;


More information about the svn-src-head mailing list