summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-12-26 23:16:46 +0000
committerChris Wilson <chris+github@qwirx.com>2014-12-26 23:16:46 +0000
commit0b067dfcbc3bfc4fa1415e5e1e2a69cf1a693653 (patch)
treef5abd94f4826ceb9c1a847c2fa68fe1dc4c59084 /lib
parent0c7bcfc15e2198181b947826e1561c1ea994b74c (diff)
Fix test failures caused by using plain stat() instead of emu_stat().
On Windows, plain stat() no longer handles slashes in filenames correctly (since upgrading MinGW? Or switching to 64-bit Windows?). We need to use POSIX fstat() for now in RaidFile, but we can still use the emu_stat, and in fact we should, to fix path translation.
Diffstat (limited to 'lib')
-rw-r--r--lib/backupstore/BackupStoreCheck.cpp5
-rw-r--r--lib/raidfile/RaidFileRead.cpp8
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/backupstore/BackupStoreCheck.cpp b/lib/backupstore/BackupStoreCheck.cpp
index 81a99b05..bef23f3f 100644
--- a/lib/backupstore/BackupStoreCheck.cpp
+++ b/lib/backupstore/BackupStoreCheck.cpp
@@ -335,9 +335,10 @@ int64_t BackupStoreCheck::CheckObjectsScanDir(int64_t StartID, int Level, const
{
// build name
std::string dn(rdiscSet[l] + DIRECTORY_SEPARATOR + rDirName);
- struct stat st;
+ EMU_STRUCT_STAT st;
- if(stat(dn.c_str(), &st) != 0 && errno == ENOENT)
+ if(EMU_STAT(dn.c_str(), &st) != 0 &&
+ errno == ENOENT)
{
if(mkdir(dn.c_str(), 0755) != 0)
{
diff --git a/lib/raidfile/RaidFileRead.cpp b/lib/raidfile/RaidFileRead.cpp
index 1396b4cd..4e7c9567 100644
--- a/lib/raidfile/RaidFileRead.cpp
+++ b/lib/raidfile/RaidFileRead.cpp
@@ -1498,8 +1498,8 @@ bool RaidFileRead::DirectoryExists(const RaidFileDiscSet &rSet, const std::strin
std::string dn(rSet[l] + DIRECTORY_SEPARATOR + rDirName);
// check for existence
- struct stat st;
- if(::stat(dn.c_str(), &st) == 0)
+ EMU_STRUCT_STAT st;
+ if(EMU_STAT(dn.c_str(), &st) == 0)
{
// Directory?
if(st.st_mode & S_IFDIR)
@@ -1617,9 +1617,9 @@ bool RaidFileRead::ReadDirectoryContents(int SetNumber, const std::string &rDirN
#ifdef HAVE_VALID_DIRENT_D_TYPE
if(DirReadType == DirReadType_FilesOnly && en->d_type == DT_REG)
#else
- struct stat st;
+ EMU_STRUCT_STAT st;
std::string fullName(dn + DIRECTORY_SEPARATOR + en->d_name);
- if(::lstat(fullName.c_str(), &st) != 0)
+ if(EMU_LSTAT(fullName.c_str(), &st) != 0)
{
THROW_EXCEPTION(RaidFileException, OSError)
}