summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-03-02 08:58:18 +0000
committerChris Wilson <chris+github@qwirx.com>2014-03-02 08:58:18 +0000
commit3552ccc25938288775d56adf70b8bf0dc8b63563 (patch)
tree2dbeaa7900c5c4aca3bf4b213052db3caa7c7428 /lib
parente0470bd4b13806d8b4274d1ecaa08514af955074 (diff)
Adding a directory when over limit returns an error instead of crashing.
Just like adding a file does.
Diffstat (limited to 'lib')
-rw-r--r--lib/backupstore/BackupCommands.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/backupstore/BackupCommands.cpp b/lib/backupstore/BackupCommands.cpp
index 468b2253..a0788f32 100644
--- a/lib/backupstore/BackupCommands.cpp
+++ b/lib/backupstore/BackupCommands.cpp
@@ -508,8 +508,26 @@ std::auto_ptr<BackupProtocolMessage> BackupProtocolCreateDirectory2::DoCommand(
}
bool alreadyExists = false;
- int64_t id = rContext.AddDirectory(mContainingDirectoryID, mDirectoryName, attr, mAttributesModTime, alreadyExists);
-
+ int64_t id;
+
+ try
+ {
+ id = rContext.AddDirectory(mContainingDirectoryID,
+ mDirectoryName, attr, mAttributesModTime, mModificationTime,
+ alreadyExists);
+ }
+ catch(BackupStoreException &e)
+ {
+ if(e.GetSubType() == BackupStoreException::AddedFileExceedsStorageLimit)
+ {
+ return PROTOCOL_ERROR(Err_StorageLimitExceeded);
+ }
+ else
+ {
+ throw;
+ }
+ }
+
if(alreadyExists)
{
return PROTOCOL_ERROR(Err_DirectoryAlreadyExists);