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)
This commit is contained in:
parent
3f332bb341
commit
ed32349f00
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user