From f9bedd322c6f1050a9743d98c747d65f953207b7 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 16 Oct 2006 23:10:08 +0000 Subject: Undefine fstat() so that we get the Win32 POSIX version, instead of our emulated version. Small code cleanup. (refs #3) --- lib/raidfile/RaidFileWrite.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'lib/raidfile/RaidFileWrite.cpp') 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 -- cgit v1.2.3