KDiskDeviceManager: Ignore invalid partitions
* Partitions with negative offsets were already ignored, now also ignore those with an invalid size of block size, too. Change-Id: I128e38773933f8eadded0977a957f607363cccbe Reviewed-on: https://review.haiku-os.org/c/805 Reviewed-by: Axel Dörfler <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
7f8f4c9c8c
commit
7c2135591b
@@ -1,8 +1,7 @@
|
||||
/*
|
||||
* Copyright 2004-2017, Haiku, Inc. All rights reserved.
|
||||
* Copyright 2003-2004, Ingo Weinhold, [email protected]. All rights reserved.
|
||||
*
|
||||
* Distributed under the terms of the MIT License.
|
||||
* Copyright 2004-2018, Haiku, Inc.
|
||||
* Copyright 2003-2004, Ingo Weinhold, [email protected].
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1373,13 +1372,19 @@ KDiskDeviceManager::_ScanPartition(KPartition* partition,
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
// This happens with some copy protected CDs. Just ignore the partition...
|
||||
if (partition->Offset() < 0)
|
||||
KPath partitionPath;
|
||||
partition->GetPath(&partitionPath);
|
||||
|
||||
// This happens with some copy protected CDs or eventually other issues.
|
||||
// Just ignore the partition...
|
||||
if (partition->Offset() < 0 || partition->BlockSize() == 0
|
||||
|| partition->Size() <= 0) {
|
||||
OUT("Partition %s has invalid parameters, ignoring it.\n",
|
||||
partitionPath.Path());
|
||||
return B_BAD_DATA;
|
||||
}
|
||||
|
||||
DBG(
|
||||
KPath partitionPath;
|
||||
partition->GetPath(&partitionPath);
|
||||
OUT("KDiskDeviceManager::_ScanPartition(%s)\n", partitionPath.Path());
|
||||
)
|
||||
|
||||
@@ -1414,7 +1419,7 @@ KDiskDeviceManager::_ScanPartition(KPartition* partition,
|
||||
|
||||
if (priority >= 0 && priority > bestPriority) {
|
||||
// new best disk system
|
||||
if (bestDiskSystem) {
|
||||
if (bestDiskSystem != NULL) {
|
||||
bestDiskSystem->FreeIdentifyCookie(partition, bestCookie);
|
||||
bestDiskSystem->Unload();
|
||||
}
|
||||
@@ -1431,7 +1436,7 @@ KDiskDeviceManager::_ScanPartition(KPartition* partition,
|
||||
}
|
||||
|
||||
// now, if we have found a disk system, let it scan the partition
|
||||
if (bestDiskSystem) {
|
||||
if (bestDiskSystem != NULL) {
|
||||
DBG(OUT(" scanning with: %s\n", bestDiskSystem->Name()));
|
||||
error = bestDiskSystem->Scan(partition, bestCookie);
|
||||
bestDiskSystem->FreeIdentifyCookie(partition, bestCookie);
|
||||
|
||||
Reference in New Issue
Block a user