mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
free_drive: Free the drive even if it's referenced. I don't know what
I was smoking when I wrote this stuff, but another fix resulted in every partition in the system being entered as a "referenced" drive.
This commit is contained in:
parent
c53e8c5654
commit
8517ec8be1
1 changed files with 7 additions and 12 deletions
|
|
@ -585,18 +585,13 @@ get_empty_sd(void)
|
|||
void
|
||||
free_drive(struct drive *drive)
|
||||
{
|
||||
if ((drive->state > drive_referenced) /* real drive */
|
||||
||(drive->flags & VF_OPEN)) { /* how can it be open without a state? */
|
||||
LOCKDRIVE(drive);
|
||||
if (drive->flags & VF_OPEN) { /* it's open, */
|
||||
close_locked_drive(drive); /* close it */
|
||||
drive->state = drive_down; /* and note the fact */
|
||||
}
|
||||
if (drive->freelist)
|
||||
Free(drive->freelist);
|
||||
bzero(drive, sizeof(struct drive)); /* this also sets drive_unallocated */
|
||||
unlockdrive(drive);
|
||||
}
|
||||
LOCKDRIVE(drive);
|
||||
if (drive->flags & VF_OPEN) /* it's open, */
|
||||
close_locked_drive(drive); /* close it */
|
||||
if (drive->freelist)
|
||||
Free(drive->freelist);
|
||||
bzero(drive, sizeof(struct drive)); /* this also sets drive_unallocated */
|
||||
unlockdrive(drive);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue