diff options
author | 2007-06-04 20:23:32 +0000 | |
---|---|---|
committer | 2007-06-04 20:23:32 +0000 | |
commit | e03ece42c1dfa29ac0a4375c890d56f56a815382 (patch) | |
tree | ed7afe0cebc3babcc35ad6797400ffd8aceff3b9 | |
parent | bluetooth isn't really useful yet, but at least give it a chance to compile (diff) | |
download | wireguard-openbsd-e03ece42c1dfa29ac0a4375c890d56f56a815382.tar.xz wireguard-openbsd-e03ece42c1dfa29ac0a4375c890d56f56a815382.zip |
avoid rounding down to zero cylinders. ok marco@
-rw-r--r-- | sbin/disklabel/editor.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index 79e9245e32d..44415ca2357 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.114 2007/06/01 21:51:15 todd Exp $ */ +/* $OpenBSD: editor.c,v 1.115 2007/06/04 20:23:32 otto 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.114 2007/06/01 21:51:15 todd Exp $"; +static char rcsid[] = "$OpenBSD: editor.c,v 1.115 2007/06/04 20:23:32 otto Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -1117,7 +1117,7 @@ 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 * lp->d_secpercyl) - offset > maxval) + if (cyls > 1 && (cyls * lp->d_secpercyl) - offset > maxval) cyls--; if (rval != (cyls * lp->d_secpercyl) - offset) { |