[PATCH v3 1/2] msvcrt: Fix _creat and _wcreat.

Lauri Kenttä lauri.kentta at gmail.com
Tue Feb 7 09:59:53 CST 2017


The second argument to _creat is pmode, not any other flag.

v2: Resend.
v3: Fix first, then add tests, to avoid random test failures.
Signed-off-by: Lauri Kenttä <lauri.kentta at gmail.com>
---
 dlls/msvcrt/file.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index b6f3d9de85..9a9ad08173 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -2416,19 +2416,19 @@ int CDECL MSVCRT__wopen(const MSVCRT_wchar_t *path,int flags,...)
 /*********************************************************************
  *		_creat (MSVCRT.@)
  */
-int CDECL MSVCRT__creat(const char *path, int flags)
+int CDECL MSVCRT__creat(const char *path, int pmode)
 {
-  int usedFlags = (flags & MSVCRT__O_TEXT)| MSVCRT__O_CREAT| MSVCRT__O_WRONLY| MSVCRT__O_TRUNC;
-  return MSVCRT__open(path, usedFlags);
+  int flags = MSVCRT__O_CREAT | MSVCRT__O_TRUNC | MSVCRT__O_RDWR;
+  return MSVCRT__open(path, flags, pmode);
 }
 
 /*********************************************************************
  *		_wcreat (MSVCRT.@)
  */
-int CDECL MSVCRT__wcreat(const MSVCRT_wchar_t *path, int flags)
+int CDECL MSVCRT__wcreat(const MSVCRT_wchar_t *path, int pmode)
 {
-  int usedFlags = (flags & MSVCRT__O_TEXT)| MSVCRT__O_CREAT| MSVCRT__O_WRONLY| MSVCRT__O_TRUNC;
-  return MSVCRT__wopen(path, usedFlags);
+  int flags = MSVCRT__O_CREAT | MSVCRT__O_TRUNC | MSVCRT__O_RDWR;
+  return MSVCRT__wopen(path, flags, pmode);
 }
 
 /*********************************************************************
-- 
2.11.1




More information about the wine-patches mailing list