diff options
author | 2007-06-08 13:52:51 +0000 | |
---|---|---|
committer | 2007-06-08 13:52:51 +0000 | |
commit | baaa8969c7276f0af61cdd377cf5546dee95bbd0 (patch) | |
tree | e9467c85bdb6db0fa97d3dda646fb0349ec9f0e3 | |
parent | disklabel_om_to_bsd() is generating a v1 label so set the label (diff) | |
download | wireguard-openbsd-baaa8969c7276f0af61cdd377cf5546dee95bbd0.tar.xz wireguard-openbsd-baaa8969c7276f0af61cdd377cf5546dee95bbd0.zip |
Fix setting total # sectors in the 'e' command.
-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 */ |