Bug in MSVCRT_fseek (with patch)

Kirill K. Smirnov lich at math.spbu.ru
Fri Apr 4 06:36:54 CDT 2008


>  A successful call to fseek() shall clear the end-of-file indicator
>  for the stream and undo any effects of ungetc() and ungetwc() on
>  the same stream. After an fseek() call, the next operation on an
>  update stream may be either input or output.

>   }
>+  /* Clear end of file */
>+  file->_flag &= ~MSVCRT__IOEOF;
>   return (_lseek(file->_file,offset,whence) == -1)?-1:0;

What if you try to fseek to the end of file (SEEK_END)? Should IOEOF flag be 
cleared in this case? And may _lseek() function be better place for this?

Current _lseeki64() implementation contains FIXME concerning the same issue:
    MSVCRT_fdesc[fd].wxflag &= ~(WX_ATEOF|WX_READEOF);
    /* FIXME: What if we seek _to_ EOF - is EOF set? */


More information about the wine-devel mailing list