Ticket #6487: partition_overlap.patch
File partition_overlap.patch, 1.6 KB (added by , 14 years ago) |
---|
-
src/add-ons/kernel/partitioning_systems/intel/PartitionMap.cpp
833 833 off_t nextOffset = 0; 834 834 for (int32 i = 0; i < byOffsetCount; i++) { 835 835 const Partition* partition = byOffset[i]; 836 if (partition->Offset() < nextOffset) { 837 TRACE(("intel: PartitionMap::Check(): overlapping partitions!" 838 "\n")); 839 result = false; 840 break; 836 if (partition->Offset() < nextOffset && i > 0) { 837 Partition* previousPartition = (Partition*)byOffset[i - 1]; 838 off_t previousSize = previousPartition->Size() 839 - (nextOffset - partition->Offset()); 840 TRACE(("intel: PartitionMap::Check(): ")); 841 if (previousSize == 0) { 842 previousPartition->Unset(); 843 TRACE(("partition offset hides previous partition." 844 " Removing previous partition from disk layout.\n")); 845 } else { 846 TRACE(("overlapping partitions! Setting partition %ld " 847 "size to %lld\n", i - 1, previousSize)); 848 previousPartition->SetSize(previousSize); 849 } 841 850 } 842 851 nextOffset = partition->Offset() + partition->Size(); 843 852 } … … 847 856 if (result) { 848 857 for (int32 i = 0; i < tableOffsetCount; i++) { 849 858 if (i > 0 && tableOffsets[i] == tableOffsets[i - 1]) { 850 TRACE(("intel: PartitionMap::Check(): same partition ta lbe "859 TRACE(("intel: PartitionMap::Check(): same partition table " 851 860 "for different extended partitions!\n")); 852 861 result = false; 853 862 break;