diff options
author | Chris Wilson <chris+github@qwirx.com> | 2015-05-06 21:29:39 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2015-05-06 21:29:39 +0000 |
commit | 41b716a473e2efae0993a0dc323cd786c329ff7a (patch) | |
tree | 9df7107d27deb5a3690f83be3d91454334f4e071 /lib/backupstore/BackupStoreAccounts.cpp | |
parent | cd0ff15b1941f997faa500962b0bfc1581501010 (diff) |
Fix missing account lock while checking for errors.
The old assertion, that the write lock file exists before starting checking,
was erroneously passing before when no lock was held, because the lockfile
was never deleted. Now that we delete it when unlocking the account, this
started causing test failures.
Changed the way that accounts are checked for errors to use a function that
acquires a write lock first, and modified test to disconnect open clients
before starting checking the account, to fix it.
Diffstat (limited to 'lib/backupstore/BackupStoreAccounts.cpp')
-rw-r--r-- | lib/backupstore/BackupStoreAccounts.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/backupstore/BackupStoreAccounts.cpp b/lib/backupstore/BackupStoreAccounts.cpp index 5f51917b..d1c7430f 100644 --- a/lib/backupstore/BackupStoreAccounts.cpp +++ b/lib/backupstore/BackupStoreAccounts.cpp @@ -594,7 +594,8 @@ bool BackupStoreAccountsControl::OpenAccount(int32_t ID, std::string &rRootDirOu return true; } -int BackupStoreAccountsControl::CheckAccount(int32_t ID, bool FixErrors, bool Quiet) +int BackupStoreAccountsControl::CheckAccount(int32_t ID, bool FixErrors, bool Quiet, + bool ReturnNumErrorsFound) { std::string rootDir; int discSetNum; @@ -612,8 +613,15 @@ int BackupStoreAccountsControl::CheckAccount(int32_t ID, bool FixErrors, bool Qu // Check it BackupStoreCheck check(rootDir, discSetNum, ID, FixErrors, Quiet); check.Check(); - - return check.ErrorsFound()?1:0; + + if(ReturnNumErrorsFound) + { + return check.GetNumErrorsFound(); + } + else + { + return check.ErrorsFound() ? 1 : 0; + } } int BackupStoreAccountsControl::CreateAccount(int32_t ID, int32_t DiscNumber, |