summaryrefslogtreecommitdiffstats
path: root/sbin/fdisk
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2011-08-19 12:48:06 +0000
committerae <ae@FreeBSD.org>2011-08-19 12:48:06 +0000
commit8b395ee11e3498950e356f3149086bc192bc5cbe (patch)
treef8f97ee3b2bee6ce031dde16475392b96815b7e9 /sbin/fdisk
parent1d37a981a81074305efad2a425ceaa0f57e29bca (diff)
downloadFreeBSD-src-8b395ee11e3498950e356f3149086bc192bc5cbe.zip
FreeBSD-src-8b395ee11e3498950e356f3149086bc192bc5cbe.tar.gz
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)
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 eb81e3b..ba1ee00 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;
OpenPOWER on IntegriCloud