From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/msvcrt/file.c | 4 +--- dlls/msvcrt/tests/file.c | 4 ---- 2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index e72784eef41..24d801a5306 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -4588,9 +4588,7 @@ FILE* CDECL _wfreopen(const wchar_t *path, const wchar_t *mode, FILE* file) TRACE(":path (%s) mode (%s) file (%p) fd (%d)\n", debugstr_w(path), debugstr_w(mode), file, file ? file->_file : -1);
LOCK_FILES(); - if (!file || ((fd = file->_file) < 0)) - file = NULL; - else + if (file) { fclose(file); if (msvcrt_get_flags(mode, &open_flags, &stream_flags) == -1) diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c index c7c9597860a..cd844de2770 100644 --- a/dlls/msvcrt/tests/file.c +++ b/dlls/msvcrt/tests/file.c @@ -1933,21 +1933,17 @@ static void test_invalid_stdin_child_subcmd( const char *subcmd ) ok(errno == 0xdeadbeef, "errno = %d\n", errno);
fd = fileno(stdin); - todo_wine ok(fd > 0, "fileno(stdin) returned %d\n", fd); ok(fd != STDIN_FILENO, "fileno(stdin) returned STDIN_FILENO\n");
errno = 0xdeadbeef; handle = (HANDLE)_get_osfhandle(fd); ok(handle != (HANDLE)-2, "handle = %p\n", handle); - todo_wine ok(errno == 0xdeadbeef, "errno = %d\n", errno);
errno = 0xdeadbeef; ret = fread(&c, 1, 1, stdin); - todo_wine ok(ret == 1, "fread(stdin) returned %d\n", ret); - todo_wine ok(errno == 0xdeadbeef, "errno = %d\n", errno); ok(c == ' ', "Unexpected char\n");