diff options
author | Chris Wilson <chris+github@qwirx.com> | 2006-09-03 23:46:11 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2006-09-03 23:46:11 +0000 |
commit | 33c64c6247b677f6233d4c529ee162f34d1535fc (patch) | |
tree | abd979ee7b10e8318b98c02e35780fdc7b0f1e4f /lib/win32/emu.cpp | |
parent | 7904931e8026a5e43bcfcdc75adb5688766b67eb (diff) |
(refs #3)
Improved error handling in emu_fstat
Diffstat (limited to 'lib/win32/emu.cpp')
-rw-r--r-- | lib/win32/emu.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/win32/emu.cpp b/lib/win32/emu.cpp index 3285f90c..41361409 100644 --- a/lib/win32/emu.cpp +++ b/lib/win32/emu.cpp @@ -580,8 +580,6 @@ char nextchar = -1; // -------------------------------------------------------------------------- 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 @@ int emu_fstat(HANDLE hdir, struct stat * st) 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; |