diff options
author | Chris Wilson <chris+github@qwirx.com> | 2008-11-30 22:24:28 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2008-11-30 22:24:28 +0000 |
commit | 6d851fd3042ef3a5e5a3a4d78b9dabbcae472684 (patch) | |
tree | 1d1169e76efde5338c6ff3ed878a505adb35be42 | |
parent | 4584e25170424be8b0f9cae7012def007619b514 (diff) |
Fix support for O_APPEND on files opened with openfile() on Windows.
-rw-r--r-- | lib/win32/emu.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/win32/emu.cpp b/lib/win32/emu.cpp index e31d8a3c..84246c67 100644 --- a/lib/win32/emu.cpp +++ b/lib/win32/emu.cpp @@ -693,6 +693,18 @@ HANDLE openfile(const char *pFileName, int flags, int mode) return INVALID_HANDLE_VALUE; } + if (flags & O_APPEND) + { + if (SetFilePointer(hdir, 0, NULL, FILE_END) == + INVALID_SET_FILE_POINTER) + { + winerrno = GetLastError(); + errno = EINVAL; + CloseHandle(hdir); + return INVALID_HANDLE_VALUE; + } + } + winerrno = NO_ERROR; return hdir; } |