aboutsummaryrefslogtreecommitdiff
path: root/sbin/fdisk
diff options
context:
space:
mode:
authorAndrey V. Elsukov <ae@FreeBSD.org>2011-08-19 12:48:06 +0000
committerAndrey V. Elsukov <ae@FreeBSD.org>2011-08-19 12:48:06 +0000
commit6bfcd9c37bc00efb632f648e10bf07bf69c13f2f (patch)
treef8f97ee3b2bee6ce031dde16475392b96815b7e9 /sbin/fdisk
parent15d837d8a05d2399d63ca2d8ce867d23de46c443 (diff)
downloadsrc-6bfcd9c37bc00efb632f648e10bf07bf69c13f2f.tar.gz
src-6bfcd9c37bc00efb632f648e10bf07bf69c13f2f.zip
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)
Notes
Notes: svn path=/head/; revision=225007
Diffstat (limited to 'sbin/fdisk')
-rw-r--r--sbin/fdisk/fdisk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index eb81e3b460a8..ba1ee002e9e5 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -940,7 +940,7 @@ decimal(const char *str, int *num, int deflt, uint32_t maxval)
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;