diff options
author | 2007-06-06 21:08:55 +0000 | |
---|---|---|
committer | 2007-06-06 21:08:55 +0000 | |
commit | 291f94445b4322e2908602171711a81fde774bd3 (patch) | |
tree | 99fc7cd7d5e849860fa482a36c8d30caa82a2a35 | |
parent | Remove IPS_D_INTR debug level, IPS_D_XFER is good enough. (diff) | |
download | wireguard-openbsd-291f94445b4322e2908602171711a81fde774bd3.tar.xz wireguard-openbsd-291f94445b4322e2908602171711a81fde774bd3.zip |
fix the cylinder rounding calculation for "totally using the space" type
calculations; ok otto millert
-rw-r--r-- | sbin/disklabel/editor.c | 7 |
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) { |