From 33a3d225c7780a5f5d38a5ac5fd068f445e5a434 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 9 Aug 2008 07:07:16 +0000 Subject: Map ERROR_SHARING_VIOLATION to EBUSY in openfile(). --- lib/win32/emu.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/win32') diff --git a/lib/win32/emu.cpp b/lib/win32/emu.cpp index 48db4ec7..5a61fc3f 100644 --- a/lib/win32/emu.cpp +++ b/lib/win32/emu.cpp @@ -667,9 +667,20 @@ HANDLE openfile(const char *pFileName, int flags, int mode) if (hdir == INVALID_HANDLE_VALUE) { + switch(GetLastError()) + { + case ERROR_SHARING_VIOLATION: + errno = EBUSY; + break; + + default: + errno = EINVAL; + } + ::syslog(LOG_WARNING, "Failed to open file '%s': " "%s", pFileName, GetErrorMessage(GetLastError()).c_str()); + return INVALID_HANDLE_VALUE; } -- cgit v1.2.3