Bug in MSVCRT_fseek (with patch)

Erik de Castro Lopo mle+win at mega-nerd.com
Fri Apr 4 17:23:10 CDT 2008

Dan Kegel wrote:

> To get your change and test accepted, please send a patch,
> and make the test a real wine conformance test.

I found a test in dlls/msvcrt/tests/file.c that seems to have been
mad inactive by use of a "todo_wine". Activating the test without
my patch results in two failures:

    file.c:244: Test failed: feof failure in binary mode
    file.c:244: Test failed: feof failure in ascii mode

Rerunning the test after my patch an these two failures disappeared.

Below is my new patch, which activates the test and fixes the bug.


diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 0c1e84b..866d28d 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -918,6 +918,8 @@ int CDECL MSVCRT_fseek(MSVCRT_FILE* file, long offset, int whence)
   if(file->_flag & MSVCRT__IORW) {
         file->_flag &= ~(MSVCRT__IOREAD|MSVCRT__IOWRT);
+  /* Clear end of file flag */
+  file->_flag &= ~MSVCRT__IOEOF;
   return (_lseek(file->_file,offset,whence) == -1)?-1:0;
diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c
index d406ae5..aa58a32 100644
--- a/dlls/msvcrt/tests/file.c
+++ b/dlls/msvcrt/tests/file.c
@@ -241,7 +241,7 @@ static void test_readmode( BOOL ascii_mode )
     ok(fread(buffer,1,1,file)==0,"fread failure in %s\n", IOMODE);
     ok(feof(file)!=0,"feof failure in %s\n", IOMODE);
     ok(fseek(file,-3,SEEK_CUR)==0,"seek failure in %s\n", IOMODE);
-    todo_wine ok(feof(file)==0,"feof failure in %s\n", IOMODE);
+    ok(feof(file)==0,"feof failure in %s\n", IOMODE);
     ok(fread(buffer,2,1,file)==1,"fread failed in %s\n", IOMODE);
     ok(feof(file)==0,"feof failure in %s\n", IOMODE);
     ok(fread(buffer,2,1,file)==0,"fread failure in %s\n",IOMODE);


Erik de Castro Lopo
Only people who suck have a problem with elitism.

More information about the wine-devel mailing list