From 61577c614fd7c2d31470485cfb457cbb61441b28 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 28 Nov 2007 02:46:34 +0000 Subject: [PATCH] set disposition to OPEN_ALWAYS for write and read-write modes (replaces patch 1836605) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/wince/filefnwce.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/msw/wince/filefnwce.cpp b/src/msw/wince/filefnwce.cpp index 3ece11a640..c96cc14f90 100644 --- a/src/msw/wince/filefnwce.cpp +++ b/src/msw/wince/filefnwce.cpp @@ -44,16 +44,19 @@ int wxCRT_Open(const wxChar *filename, int oflag, int WXUNUSED(pmode)) { access = GENERIC_READ; shareMode = FILE_SHARE_READ|FILE_SHARE_WRITE; - disposition |= OPEN_EXISTING; + disposition = OPEN_EXISTING; } else if ((oflag & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY) { access = GENERIC_WRITE; + disposition = OPEN_ALWAYS; } else if ((oflag & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDWR) { access = GENERIC_READ|GENERIC_WRITE; + disposition = OPEN_ALWAYS; } + if (oflag & O_APPEND) { if ( wxFile::Exists(filename) ) @@ -62,16 +65,16 @@ int wxCRT_Open(const wxChar *filename, int oflag, int WXUNUSED(pmode)) shareMode = FILE_SHARE_READ; disposition = OPEN_EXISTING; } - //else: fall through as write_append is the same as write if the - // file doesn't exist else + { oflag |= O_TRUNC; + } } if (oflag & O_TRUNC) { access |= GENERIC_WRITE; shareMode = 0; - disposition = (oflag & O_CREAT) ? CREATE_ALWAYS : TRUNCATE_EXISTING; + disposition = oflag & O_CREAT ? CREATE_ALWAYS : TRUNCATE_EXISTING; } else if (oflag & O_CREAT) { -- 2.45.2