Module: wine
Branch: refs/heads/master
Commit: 72017cc9ab31382b8d47005c5e843b635e96d208
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=72017cc9ab31382b8d47005…
Author: Peter Beutner <p.beutner(a)gmx.net>
Date: Fri Feb 17 17:38:03 2006 +0100
msvcrt: Correctly set EOF flag in fread().
Setting the EOF flag only if _read() returns zero is not enough as we
could also read something AND hit the end of file.
_read() already sets another internal EOF flag, so just use this too.
Removing todo_wine from the test case.
---
dlls/msvcrt/file.c | 2 +-
dlls/msvcrt/tests/file.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 14e786a..9162ee7 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -2503,7 +2503,7 @@ MSVCRT_size_t MSVCRT_fread(void *ptr, MS
/* expose feof condition in the flags
* MFC tests file->_flag for feof, and doesn't not call feof())
*/
- if (pread == 0)
+ if ( MSVCRT_fdesc[file->_file].wxflag & WX_ATEOF)
file->_flag |= MSVCRT__IOEOF;
else if (pread == -1)
{
diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c
index 086c37f..bcc60fd 100644
--- a/dlls/msvcrt/tests/file.c
+++ b/dlls/msvcrt/tests/file.c
@@ -125,7 +125,7 @@ static void test_fileops( void )
/* sizeof(buffer) > content of file */
ok(fread(buffer, sizeof(buffer), 1, file) == 0, "fread test failed\n");
/* feof should be set now */
- todo_wine ok(feof(file), "feof after fread failed\n");
+ ok(feof(file), "feof after fread failed\n");
fclose (file);
unlink ("fdopen.tst");