[PATCH v2 2/2] msvcrt: Fix _creat and _wcreat.
Lauri Kenttä
lauri.kentta at gmail.com
Mon Feb 6 12:30:47 CST 2017
The second argument to _creat is pmode, not any other flag.
v2: Resend.
Signed-off-by: Lauri Kenttä <lauri.kentta at gmail.com>
---
dlls/msvcrt/file.c | 12 ++++++------
dlls/msvcrt/tests/file.c | 3 ---
2 files changed, 6 insertions(+), 9 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);
}
/*********************************************************************
diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c
index 48c08e8a19..2c356ea964 100644
--- a/dlls/msvcrt/tests/file.c
+++ b/dlls/msvcrt/tests/file.c
@@ -2410,7 +2410,6 @@ static void test__creat(void)
}
ok(_lseek(fd, SEEK_SET, 0) == 0, "_lseek failed\n");
count = _read(fd, buf, 6);
-todo_wine
ok(count == 4, "_read returned %d, expected 4\n", count);
count = count > 0 ? count > 4 ? 4 : count : 0;
ok(memcmp(buf, testdata, count) == 0, "_read returned wrong contents\n");
@@ -2431,13 +2430,11 @@ todo_wine
}
ok(_lseek(fd, SEEK_SET, 0) == 0, "_lseek failed\n");
count = _read(fd, buf, 6);
-todo_wine
ok(count == 4, "_read returned %d, expected 4\n", count);
count = count > 0 ? count > 4 ? 4 : count : 0;
ok(memcmp(buf, testdata, count) == 0, "_read returned wrong contents\n");
_close(fd);
readonly = GetFileAttributesA("_creat.tst") & FILE_ATTRIBUTE_READONLY;
-todo_wine
ok(!readonly, "expected rw file\n");
SetFileAttributesA("_creat.tst", FILE_ATTRIBUTE_NORMAL);
DeleteFileA("_creat.tst");
--
2.11.1
More information about the wine-patches
mailing list