diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2007-06-08 13:52:52 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2007-06-08 13:52:52 +0000 |
commit | b6b02fc51c679a204f508559557e7249c8bb1514 (patch) | |
tree | 8040579e3a905e35c4328df04e0834b5b62c6756 /sbin/disklabel | |
parent | a5ef0d0cf0dec01c9422b3f55a1a2dd9fccf2e9c (diff) |
Fix setting total # sectors in the 'e' command.
Diffstat (limited to 'sbin/disklabel')
-rw-r--r-- | sbin/disklabel/editor.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index 09a173faf7a..2a775e8a7b6 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.117 2007/06/07 21:47:16 millert Exp $ */ +/* $OpenBSD: editor.c,v 1.118 2007/06/08 13:52:51 millert 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.117 2007/06/07 21:47:16 millert Exp $"; +static char rcsid[] = "$OpenBSD: editor.c,v 1.118 2007/06/08 13:52:51 millert Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -1326,11 +1326,11 @@ edit_parms(struct disklabel *lp, u_int32_t *freep) /* total sectors */ for (;;) { + u_int32_t nsec = MAX(lp->d_secperunit, + lp->d_ncylinders * lp->d_secpercyl); ui = getuint(lp, 0, "total sectors", "The total number of sectors on the disk.", - lp->d_secperunit ? lp->d_secperunit : - lp->d_ncylinders * lp->d_ncylinders, - lp->d_ncylinders * lp->d_ncylinders, 0, 0); + nsec, nsec, 0, 0); if (ui == UINT_MAX - 1) { fputs("Command aborted\n", stderr); *lp = oldlabel; /* undo damage */ |