ext2: fix logic error.
* Thanks to Ingo and Jérôme for review. * The Remove can't fail after a succesful Lookup so don't check for that * Return B_OK on success
This commit is contained in:
@@ -63,13 +63,13 @@ status_t
|
|||||||
HashRevokeManager::Insert(uint32 block, uint32 commitID)
|
HashRevokeManager::Insert(uint32 block, uint32 commitID)
|
||||||
{
|
{
|
||||||
RevokeElement* element = fHash->Lookup(block);
|
RevokeElement* element = fHash->Lookup(block);
|
||||||
|
|
||||||
if (element != NULL) {
|
if (element != NULL) {
|
||||||
TRACE("HashRevokeManager::Insert(): Already has an element\n");
|
TRACE("HashRevokeManager::Insert(): Already has an element\n");
|
||||||
if (element->commitID < commitID) {
|
if (element->commitID < commitID) {
|
||||||
TRACE("HashRevokeManager::Insert(): Deleting previous element\n");
|
TRACE("HashRevokeManager::Insert(): Deleting previous element\n");
|
||||||
bool retValue = fHash->Remove(element);
|
bool retValue = fHash->Remove(element);
|
||||||
|
|
||||||
if (!retValue)
|
if (!retValue)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
@@ -92,12 +92,11 @@ HashRevokeManager::Remove(uint32 block)
|
|||||||
if (element == NULL)
|
if (element == NULL)
|
||||||
return B_ERROR; // TODO: Perhaps we should just ignore?
|
return B_ERROR; // TODO: Perhaps we should just ignore?
|
||||||
|
|
||||||
bool retValue = fHash->Remove(element);
|
fHash->Remove(element);
|
||||||
|
// Can't fail as we just did a sucessful Lookup()
|
||||||
if (retValue)
|
|
||||||
delete element;
|
|
||||||
|
|
||||||
return B_ERROR;
|
delete element;
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user