From 3552ccc25938288775d56adf70b8bf0dc8b63563 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 2 Mar 2014 08:58:18 +0000 Subject: Adding a directory when over limit returns an error instead of crashing. Just like adding a file does. --- lib/backupstore/BackupCommands.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'lib') 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 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); -- cgit v1.2.3