Subject: CVS commit: src/sbin/disklabel
To: None <source-changes@NetBSD.org>
From: David Brownlee <abs@netbsd.org>
List: source-changes
Date: 06/22/2004 18:32:46
Module Name:	src
Committed By:	abs
Date:		Tue Jun 22 18:32:46 UTC 2004

Modified Files:
	src/sbin/disklabel: disklabel.c

Log Message:
Fix some interesting disklabel lossage:

If the input to 'disklabel' (non -i) referenced a partition two or more
larger than that permitted by npartitions it would error out with 'bad
partition name' (and the option given to re-edit if -e). If a partition one
larger was used it would be dropped from the disklabel with a warning and the
label written anyway! The (off by one) check for a bad partition name was
against npartitions anyway, rather than MAXPARTITIONS. npartitions was just
read from the disklabel and could have been set to an arbitrary value.

Given 'disklabel -i' sets npartitions automatically, make the normal case
check partition names against MAXPARTITIONS, and if necessary increase
npartitions to the size needed to hold the last partition used.

While here remove two 'write only' uses of a 'part' variable.


To generate a diff of this commit:
cvs rdiff -r1.131 -r1.132 src/sbin/disklabel/disklabel.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.