summaryrefslogtreecommitdiff
path: root/sbin/disklabel
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-06-06 21:08:56 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-06-06 21:08:56 +0000
commit285d1aeb970549ce96811eff817eb70e172fe161 (patch)
treec3fecea961560d580c6897ff1683a0497731d4bd /sbin/disklabel
parentb263e23dbbed6f5b54ab0010acbb10f825a2b4e2 (diff)
fix the cylinder rounding calculation for "totally using the space" type
calculations; ok otto millert
Diffstat (limited to 'sbin/disklabel')
-rw-r--r--sbin/disklabel/editor.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index 44415ca2357..78e8d425ecd 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.115 2007/06/04 20:23:32 otto Exp $ */
+/* $OpenBSD: editor.c,v 1.116 2007/06/06 21:08:55 deraadt Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -17,7 +17,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: editor.c,v 1.115 2007/06/04 20:23:32 otto Exp $";
+static char rcsid[] = "$OpenBSD: editor.c,v 1.116 2007/06/06 21:08:55 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -1117,7 +1117,8 @@ getuint(struct disklabel *lp, int partno, char *prompt, char *helpstring,
/* If we round up past the end, round down instead */
cyls = (rval + lp->d_secpercyl / 2) / lp->d_secpercyl;
if (cyls != 0 && lp->d_secpercyl != 0) {
- if (cyls > 1 && (cyls * lp->d_secpercyl) - offset > maxval)
+ if (maxval && cyls > 1 &&
+ (cyls * lp->d_secpercyl) - offset > maxval)
cyls--;
if (rval != (cyls * lp->d_secpercyl) - offset) {