diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-02-09 22:30:15 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-02-09 22:30:15 +0000 |
commit | 6779d3cb4ffcc9fa7d860a6f4abaa5bed009098c (patch) | |
tree | dd10f8e3953a7a6b32253793439d05c03f69b098 /lib/backupclient | |
parent | 277b5be1d6b04b9176c691659149db0402f14cc5 (diff) |
Catch errors during restore (refs #3)
Diffstat (limited to 'lib/backupclient')
-rw-r--r-- | lib/backupclient/BackupClientRestore.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/lib/backupclient/BackupClientRestore.cpp b/lib/backupclient/BackupClientRestore.cpp index b752b6a2..65ee377c 100644 --- a/lib/backupclient/BackupClientRestore.cpp +++ b/lib/backupclient/BackupClientRestore.cpp @@ -19,6 +19,7 @@ #include <set> #include <limits.h> #include <stdio.h> +#include <errno.h> #include "BackupClientRestore.h" #include "autogen_BackupProtocolClient.h" @@ -225,9 +226,36 @@ static void BackupClientRestoreDir(BackupProtocolClient &rConnection, int64_t Di // Save the resumption information Params.mResumeInfo.Save(Params.mRestoreResumeInfoFilename); + + // Create the local directory, if not already done. + // Path and owner set later, just use restrictive owner mode. + + int exists; + + try + { + exists = ObjectExists(rLocalDirectoryName.c_str()); + } + catch (BoxException &e) + { + ::syslog(LOG_ERR, "Failed to check existence for %s: %s", + rLocalDirectoryName.c_str(), e.what()); + return Restore_UnknownError; + } + catch(std::exception &e) + { + ::syslog(LOG_ERR, "Failed to check existence for %s: %s", + rLocalDirectoryName.c_str(), e.what()); + return Restore_UnknownError; + } + catch(...) + { + ::syslog(LOG_ERR, "Failed to check existence for %s: " + "unknown error", rLocalDirectoryName.c_str()); + return Restore_UnknownError; + } - // Create the local directory (if not already done) -- path and owner set later, just use restrictive owner mode - switch(ObjectExists(rLocalDirectoryName.c_str())) + switch(exists) { case ObjectExists_Dir: // Do nothing |