Skip to content

Commit

Permalink
Fix errors reports on Windows console due to opening invalid paths
Browse files Browse the repository at this point in the history
  • Loading branch information
qris committed Apr 6, 2018
1 parent 0aca783 commit 582e9c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 11 additions & 1 deletion lib/backupstore/BackupFileSystem.cpp
Expand Up @@ -992,7 +992,17 @@ RaidBackupFileSystem::CheckObjects(bool fix_errors)
// Find the maximum start ID of directories -- worked out by looking at disc
// contents, not trusting anything.
CheckObjectsResult result;
CheckObjectsScanDir(0, 1, mAccountRootDir, result, fix_errors);

// The root directory is unusual because its path always ends with a slash (this is enforced by
// (RaidBackupFileSystem::RaidBackupFileSystem). But all the other paths passed to
// CheckObjectsScanDir do not, so it appends one, and double slashes cause errors which
// OpenFileByNameUtf8 tries to write to the syslog, which we don't want, so we check for and
// remove the trailing slash from mAccountRootDir here:
ASSERT(mAccountRootDir[mAccountRootDir.size() - 1] == '/' ||
mAccountRootDir[mAccountRootDir.size() - 1] == DIRECTORY_SEPARATOR_ASCHAR);

CheckObjectsScanDir(0, 1, mAccountRootDir.substr(0, mAccountRootDir.size() - 1), result,
fix_errors);

// Then go through and scan all the objects within those directories
for(int64_t start_id = 0; start_id <= result.maxObjectIDFound;
Expand Down
3 changes: 1 addition & 2 deletions lib/raidfile/RaidFileWrite.cpp
Expand Up @@ -674,8 +674,7 @@ void RaidFileWrite::TransformToRaidStorage()
{ \
if (EMU_UNLINK(file) != 0 && errno != ENOENT) \
{ \
THROW_EMU_ERROR("Failed to unlink raidfile " \
"stripe: " << file, RaidFileException, \
THROW_EMU_ERROR("Failed to unlink raidfile stripe: " << file, RaidFileException, \
OSError); \
} \
}
Expand Down

0 comments on commit 582e9c0

Please sign in to comment.