diff options
Diffstat (limited to 'lib/raidfile')
-rw-r--r-- | lib/raidfile/RaidFileRead.cpp | 3 | ||||
-rw-r--r-- | lib/raidfile/RaidFileWrite.cpp | 24 |
2 files changed, 16 insertions, 11 deletions
diff --git a/lib/raidfile/RaidFileRead.cpp b/lib/raidfile/RaidFileRead.cpp index ad040c22..363c638b 100644 --- a/lib/raidfile/RaidFileRead.cpp +++ b/lib/raidfile/RaidFileRead.cpp @@ -43,6 +43,9 @@ #define READ_NUMBER_DISCS_REQUIRED 3 #define READV_MAX_BLOCKS 64 +// We want to use POSIX fstat() for now, not the emulated one +#undef fstat + // -------------------------------------------------------------------------- // // Class diff --git a/lib/raidfile/RaidFileWrite.cpp b/lib/raidfile/RaidFileWrite.cpp index 2de9dde5..66ab81c8 100644 --- a/lib/raidfile/RaidFileWrite.cpp +++ b/lib/raidfile/RaidFileWrite.cpp @@ -35,6 +35,9 @@ // Must have this number of discs in the set #define TRANSFORM_NUMBER_DISCS_REQUIRED 3 +// we want to use POSIX fstat() for now, not the emulated one +#undef fstat + // -------------------------------------------------------------------------- // // Function @@ -567,18 +570,17 @@ void RaidFileWrite::TransformToRaidStorage() #ifdef WIN32 // Must delete before renaming - if (::unlink(stripe1Filename.c_str()) != 0 && errno != ENOENT) - { - THROW_EXCEPTION(RaidFileException, OSError); - } - if (::unlink(stripe2Filename.c_str()) != 0 && errno != ENOENT) - { - THROW_EXCEPTION(RaidFileException, OSError); - } - if (::unlink(parityFilename.c_str()) != 0 && errno != ENOENT) - { - THROW_EXCEPTION(RaidFileException, OSError); + #define CHECK_UNLINK(file) \ + { \ + if (::unlink(file) != 0 && errno != ENOENT) \ + { \ + THROW_EXCEPTION(RaidFileException, OSError); \ + } \ } + CHECK_UNLINK(stripe1Filename.c_str()); + CHECK_UNLINK(stripe2Filename.c_str()); + CHECK_UNLINK(parityFilename.c_str()); + #undef CHECK_UNLINK #endif // Rename them into place |