[Box Backup-commit] COMMIT r1251 - box/chris/merge/bin/bbackupd
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Mon, 15 Jan 2007 22:10:31 +0000
Author: chris
Date: 2007-01-15 22:10:30 +0000 (Mon, 15 Jan 2007)
New Revision: 1251
Modified:
box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp
box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.h
box/chris/merge/bin/bbackupd/BackupDaemon.h
Log:
Skip mount points and NTFS reparse points inside a location, even if
not excluded (refs #3)
Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp
===================================================================
--- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-01-15 21:38:53 UTC (rev 1250)
+++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.cpp 2007-01-15 22:10:30 UTC (rev 1251)
@@ -193,6 +193,23 @@
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 @@
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 @@
}
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 @@
// 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);
Modified: box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.h
===================================================================
--- box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.h 2007-01-15 21:38:53 UTC (rev 1250)
+++ box/chris/merge/bin/bbackupd/BackupClientDirectoryRecord.h 2007-01-15 22:10:30 UTC (rev 1251)
@@ -52,6 +52,9 @@
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;
Modified: box/chris/merge/bin/bbackupd/BackupDaemon.h
===================================================================
--- box/chris/merge/bin/bbackupd/BackupDaemon.h 2007-01-15 21:38:53 UTC (rev 1250)
+++ box/chris/merge/bin/bbackupd/BackupDaemon.h 2007-01-15 22:10:30 UTC (rev 1251)
@@ -224,6 +224,18 @@
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)