summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-04-29 19:22:46 +0000
committerChris Wilson <chris+github@qwirx.com>2014-04-29 19:22:46 +0000
commit1ce71f487e6cd6514198c3769cd0a337395c1f8e (patch)
tree4f2d8b6ebcf145eccc270a500fbc355d075b3b3a /lib
parent3d89893047b1bee1b39035101b92179e85986e1e (diff)
Fix error when modifying a directory with missing entry in parent.
This is hopefully the cause of the segfaults reported by Brendon Baumgartner.
Diffstat (limited to 'lib')
-rw-r--r--lib/backupstore/BackupStoreContext.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/backupstore/BackupStoreContext.cpp b/lib/backupstore/BackupStoreContext.cpp
index 974c4e3e..0fdbe106 100644
--- a/lib/backupstore/BackupStoreContext.cpp
+++ b/lib/backupstore/BackupStoreContext.cpp
@@ -1017,10 +1017,20 @@ void BackupStoreContext::SaveDirectory(BackupStoreDirectory &rDir)
GetDirectoryInternal(rDir.GetContainerID()));
BackupStoreDirectory::Entry* en =
parent.FindEntryByID(rDir.GetObjectID());
- ASSERT(en);
- ASSERT(en->GetSizeInBlocks() == old_dir_size);
- en->SetSizeInBlocks(new_dir_size);
- SaveDirectory(parent);
+ if(!en)
+ {
+ BOX_ERROR("Missing entry for directory " <<
+ BOX_FORMAT_OBJECTID(rDir.GetObjectID()) <<
+ " in directory " <<
+ BOX_FORMAT_OBJECTID(rDir.GetContainerID()) <<
+ " while trying to update dir size in parent");
+ }
+ else
+ {
+ ASSERT(en->GetSizeInBlocks() == old_dir_size);
+ en->SetSizeInBlocks(new_dir_size);
+ SaveDirectory(parent);
+ }
}
}
catch(...)