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.
This commit is contained in:
Peter Beutner 2006-02-17 17:38:03 +01:00 committed by Alexandre Julliard
parent b786ea588c
commit 72017cc9ab
2 changed files with 2 additions and 2 deletions

View File

@ -2503,7 +2503,7 @@ MSVCRT_size_t MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nmemb, M
/* expose feof condition in the flags /* expose feof condition in the flags
* MFC tests file->_flag for feof, and doesn't not call feof()) * 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; file->_flag |= MSVCRT__IOEOF;
else if (pread == -1) else if (pread == -1)
{ {

View File

@ -125,7 +125,7 @@ static void test_fileops( void )
/* sizeof(buffer) > content of file */ /* sizeof(buffer) > content of file */
ok(fread(buffer, sizeof(buffer), 1, file) == 0, "fread test failed\n"); ok(fread(buffer, sizeof(buffer), 1, file) == 0, "fread test failed\n");
/* feof should be set now */ /* 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); fclose (file);
unlink ("fdopen.tst"); unlink ("fdopen.tst");