summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sade
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2004-09-15 08:19:03 +0000
committerdelphij <delphij@FreeBSD.org>2004-09-15 08:19:03 +0000
commite18510b418bf9c57ecf356f49053b7b9c7252b1e (patch)
tree7cc251d38d70c064c28cf8e560e6454d72016973 /usr.sbin/sade
parent9eb29202ee07f54c8606e3159a21849418067aa0 (diff)
downloadFreeBSD-src-e18510b418bf9c57ecf356f49053b7b9c7252b1e.zip
FreeBSD-src-e18510b418bf9c57ecf356f49053b7b9c7252b1e.tar.gz
Clear all "active partition" bits before we set a new one.
This adds a safebelt that prevents users to mark more than one "active" partitions, which will lead to a unbootable machine, especially in multi-boot configurations. PR: bin/71404 MFC After: 3 days Approved by: murray (mentor)
Diffstat (limited to 'usr.sbin/sade')
-rw-r--r--usr.sbin/sade/disks.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c
index 234c59c..1e35c7b 100644
--- a/usr.sbin/sade/disks.c
+++ b/usr.sbin/sade/disks.c
@@ -74,7 +74,8 @@ enum size_units_t { UNIT_BLOCKS, UNIT_KILO, UNIT_MEG, UNIT_GIG, UNIT_SIZE };
#define CHUNK_START_ROW 5
/* Where we keep track of MBR chunks */
-static struct chunk *chunk_info[16];
+#define CHUNK_INFO_ENTRIES 16
+static struct chunk *chunk_info[CHUNK_INFO_ENTRIES];
static int current_chunk;
static void diskPartitionNonInteractive(Device *dev);
@@ -312,6 +313,7 @@ diskPartition(Device *dev)
{
char *cp, *p;
int rv, key = 0;
+ int i;
Boolean chunking;
char *msg = NULL;
#ifdef PC98
@@ -535,6 +537,10 @@ diskPartition(Device *dev)
break;
case 'S':
+ /* Clear active states so we won't have two */
+ for (i = 0; (chunk_info[i] != NULL) && (i < CHUNK_INFO_ENTRIES); i++)
+ chunk_info[i]->flags &= !CHUNK_ACTIVE;
+
/* Set Bootable */
chunk_info[current_chunk]->flags |= CHUNK_ACTIVE;
break;
OpenPOWER on IntegriCloud