[Box Backup-commit] COMMIT r952 - box/chris/merge/lib/win32

subversion at fluffy.co.uk subversion at fluffy.co.uk
Mon Sep 4 00:46:11 BST 2006


Author: chris
Date: 2006-09-04 00:46:11 +0100 (Mon, 04 Sep 2006)
New Revision: 952

Modified:
   box/chris/merge/lib/win32/emu.cpp
Log:
(refs #3)

Improved error handling in emu_fstat


Modified: box/chris/merge/lib/win32/emu.cpp
===================================================================
--- box/chris/merge/lib/win32/emu.cpp	2006-09-03 23:41:31 UTC (rev 951)
+++ box/chris/merge/lib/win32/emu.cpp	2006-09-03 23:46:11 UTC (rev 952)
@@ -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;




More information about the Boxbackup-commit mailing list