[Box Backup-commit] COMMIT r1255 - box/chris/merge/lib/common
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Mon, 15 Jan 2007 23:52:15 +0000
Author: chris
Date: 2007-01-15 23:52:14 +0000 (Mon, 15 Jan 2007)
New Revision: 1255
Modified:
box/chris/merge/lib/common/FileStream.cpp
Log:
Throw CommonException AccessDenied if we didn't get access to the file,
for better error description (refs #3)
Modified: box/chris/merge/lib/common/FileStream.cpp
===================================================================
--- box/chris/merge/lib/common/FileStream.cpp 2007-01-15 23:51:12 UTC (rev 1254)
+++ box/chris/merge/lib/common/FileStream.cpp 2007-01-15 23:52:14 UTC (rev 1255)
@@ -11,6 +11,8 @@
#include "FileStream.h"
#include "CommonException.h"
+#include <errno.h>
+
#include "MemLeakFindOn.h"
// --------------------------------------------------------------------------
@@ -36,7 +38,15 @@
#endif
{
MEMLEAKFINDER_NOT_A_LEAK(this);
- THROW_EXCEPTION(CommonException, OSFileOpenError)
+
+ if(errno == EACCES)
+ {
+ THROW_EXCEPTION(CommonException, AccessDenied)
+ }
+ else
+ {
+ THROW_EXCEPTION(CommonException, OSFileOpenError)
+ }
}
#ifdef WIN32
this->fileName = Filename;