[Box Backup-commit] COMMIT r1125 - box/trunk/lib/win32
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Fri, 27 Oct 2006 20:19:05 +0100
Author: chris
Date: 2006-10-27 20:19:05 +0100 (Fri, 27 Oct 2006)
New Revision: 1125
Modified:
box/trunk/lib/win32/emu.cpp
Log:
Improved error handling in emu_fstat.
Modified: box/trunk/lib/win32/emu.cpp
===================================================================
--- box/trunk/lib/win32/emu.cpp 2006-10-27 19:18:25 UTC (rev 1124)
+++ box/trunk/lib/win32/emu.cpp 2006-10-27 19:19:05 UTC (rev 1125)
@@ -580,8 +580,6 @@
// --------------------------------------------------------------------------
int emu_fstat(HANDLE hdir, struct stat * st)
{
- ULARGE_INTEGER conv;
-
if (hdir == INVALID_HANDLE_VALUE)
{
::syslog(LOG_ERR, "Error: invalid file handle in emu_fstat()");
@@ -598,9 +596,18 @@
return -1;
}
+ if (INVALID_FILE_ATTRIBUTES == fi.dwFileAttributes)
+ {
+ ::syslog(LOG_WARNING, "Failed to get file attributes: "
+ "error %d", GetLastError());
+ errno = EACCES;
+ return -1;
+ }
+
memset(st, 0, sizeof(*st));
- // This next example is how we get our INODE (equivalent) information
+ // This is how we get our INODE (equivalent) information
+ ULARGE_INTEGER conv;
conv.HighPart = fi.nFileIndexHigh;
conv.LowPart = fi.nFileIndexLow;
st->st_ino = (_ino_t)conv.QuadPart;