[Box Backup-dev] COMMIT r862 - box/chris/merge/bin/bbstored
Ben Summers
boxbackup-dev at fluffy.co.uk
Fri Sep 1 09:09:52 BST 2006
Not nice. Either use exception handlers or that new class we
discussed to make sure the unlink happens.
Ben
On 31 Aug 2006, at 21:08, subversion at fluffy.co.uk wrote:
> Author: chris
> Date: 2006-08-31 21:08:11 +0100 (Thu, 31 Aug 2006)
> New Revision: 862
>
> Modified:
> box/chris/merge/bin/bbstored/BackupContext.cpp
> Log:
> * bin/bbstored/BackupContext.cpp
> - Delete the temporary file on Win32 just like on other platforms
> (note
> that this reduces the guarantees that the file will be deleted,
> especially if an exception is thrown, refs #819)
>
>
> Modified: box/chris/merge/bin/bbstored/BackupContext.cpp
> ===================================================================
> --- box/chris/merge/bin/bbstored/BackupContext.cpp 2006-08-31
> 19:59:02 UTC (rev 861)
> +++ box/chris/merge/bin/bbstored/BackupContext.cpp 2006-08-31
> 20:08:11 UTC (rev 862)
> @@ -125,7 +125,6 @@
> //
> ----------------------------------------------------------------------
> ----
> bool BackupContext::AttemptToGetWriteLock()
> {
> -#ifndef WIN32
> // Make the filename of the write lock file
> std::string writeLockFile;
> StoreStructure::MakeWriteLockFilename(mStoreRoot, mStoreDiscSet,
> writeLockFile);
> @@ -159,10 +158,6 @@
> }
>
> return gotLock;
> -#else // WIN32
> - // no housekeeping process, we do have the lock
> - return true;
> -#endif // !WIN32
> }
>
>
> @@ -466,12 +461,6 @@
> #else
> FileStream diff(tempFn.c_str(), O_RDWR | O_CREAT | O_EXCL);
> FileStream diff2(tempFn.c_str(), O_RDONLY);
> -
> - // Unlink it immediately, so it definitely goes away
> - if(::unlink(tempFn.c_str()) != 0)
> - {
> - THROW_EXCEPTION(CommonException, OSFileError);
> - }
> #endif
>
> // Stream the incoming diff to this temporary file
> @@ -514,6 +503,14 @@
> spaceAdjustFromDiff = from->GetDiscUsageInBlocks() -
> oldVersionNewBlocksUsed;
>
> // Everything cleans up here...
> + diff.Close();
> + diff2.Close();
> +
> + // Unlink the temporary file
> + if(::unlink(tempFn.c_str()) != 0)
> + {
> + THROW_EXCEPTION(CommonException, OSFileError);
> + }
> }
> catch(...)
> {
>
> _______________________________________________
> Boxbackup-dev mailing list
> Boxbackup-dev at fluffy.co.uk
> http://lists.warhead.org.uk/mailman/listinfo/boxbackup-dev
More information about the Boxbackup-dev
mailing list