diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-01-15 22:10:30 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-01-15 22:10:30 +0000 |
commit | e04804ca2f08402ac6b8fa7d043767eb42738de7 (patch) | |
tree | 9c920db63af168f6e22b5e288a752394dd6c1321 | |
parent | b8e98d8ef95d57d81535e6c6e5dcbd411990669a (diff) |
Skip mount points and NTFS reparse points inside a location, even if
not excluded (refs #3)
-rw-r--r-- | bin/bbackupd/BackupClientDirectoryRecord.cpp | 38 | ||||
-rw-r--r-- | bin/bbackupd/BackupClientDirectoryRecord.h | 3 | ||||
-rw-r--r-- | bin/bbackupd/BackupDaemon.h | 12 |
3 files changed, 48 insertions, 5 deletions
diff --git a/bin/bbackupd/BackupClientDirectoryRecord.cpp b/bin/bbackupd/BackupClientDirectoryRecord.cpp index f24fc594..3ed974b8 100644 --- a/bin/bbackupd/BackupClientDirectoryRecord.cpp +++ b/bin/bbackupd/BackupClientDirectoryRecord.cpp @@ -193,6 +193,23 @@ void BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::Syn std::vector<std::string> dirs; std::vector<std::string> files; bool downloadDirectoryRecordBecauseOfFutureFiles = false; + + struct stat dir_st; + if(::lstat(rLocalPath.c_str(), &dir_st) != 0) + { + // Report the error (logs and + // eventual email to administrator) + rParams.GetProgressNotifier().NotifyFileStatFailed(this, + rLocalPath, strerror(errno)); + + // FIXME move to NotifyFileStatFailed() + SetErrorWhenReadingFilesystemObject(rParams, + rLocalPath.c_str()); + + // This shouldn't happen, so we'd better not continue + THROW_EXCEPTION(CommonException, OSFileError) + } + // BLOCK { // read the contents... @@ -281,6 +298,14 @@ void BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::Syn continue; } + if(st.st_dev != dir_st.st_dev) + { + rParams.GetProgressNotifier() + .NotifyMountPointSkipped(this, + filename); + continue; + } + int type = st.st_mode & S_IFMT; #endif @@ -324,11 +349,6 @@ void BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::Syn } else { - #ifdef WIN32 - ::syslog(LOG_ERR, "Unknown file type: " - "%d (%s)", type, - filename.c_str()); - #endif rParams.GetProgressNotifier() .NotifyUnsupportedFileType( this, filename); @@ -358,6 +378,14 @@ void BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::Syn // Ignore this entry for now. continue; } + + if(st.st_dev != dir_st.st_dev) + { + rParams.GetProgressNotifier() + .NotifyMountPointSkipped(this, + filename); + continue; + } #endif checksum_info.mModificationTime = FileModificationTime(st); diff --git a/bin/bbackupd/BackupClientDirectoryRecord.h b/bin/bbackupd/BackupClientDirectoryRecord.h index d7673920..39797466 100644 --- a/bin/bbackupd/BackupClientDirectoryRecord.h +++ b/bin/bbackupd/BackupClientDirectoryRecord.h @@ -52,6 +52,9 @@ class ProgressNotifier const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath, const std::string& rErrorMsg) = 0; + virtual void NotifyMountPointSkipped( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; virtual void NotifyFileExcluded( const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath) = 0; diff --git a/bin/bbackupd/BackupDaemon.h b/bin/bbackupd/BackupDaemon.h index 275603fc..5e3728d0 100644 --- a/bin/bbackupd/BackupDaemon.h +++ b/bin/bbackupd/BackupDaemon.h @@ -224,6 +224,18 @@ public: BOX_WARNING("Failed to list directory: " << rLocalPath << ": " << rErrorMsg); } + virtual void NotifyMountPointSkipped( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) + { + BOX_WARNING("Ignored directory: " << rLocalPath << ": " + #ifdef WIN32 + "is an NTFS junction/reparse point; " + #else + "is a mount point; " + #endif + "create a new location if you want to back it up"); + } virtual void NotifyFileExcluded( const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath) |