Commit 8e56d0fe authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

msvcrt: Fsetpos resets EOF flag.

parent c9ff04c3
......@@ -4682,19 +4682,7 @@ errno_t CDECL freopen_s(FILE** pFile,
*/
int CDECL fsetpos(FILE* file, fpos_t *pos)
{
int ret;
_lock_file(file);
msvcrt_flush_buffer(file);
/* Reset direction of i/o */
if(file->_flag & _IORW) {
file->_flag &= ~(_IOREAD|_IOWRT);
}
ret = (_lseeki64(file->_file,*pos,SEEK_SET) == -1) ? -1 : 0;
_unlock_file(file);
return ret;
return _fseeki64(file,*pos,SEEK_SET);
}
/*********************************************************************
......
......@@ -226,7 +226,50 @@ static void test_fileops( void )
ok(fread(buffer, sizeof(buffer), 1, file) == 0, "fread test failed\n");
/* feof should be set now */
ok(feof(file), "feof after fread failed\n");
fclose (file);
clearerr(file);
ok(!feof(file), "feof after clearerr failed\n");
fclose(file);
file = fopen("fdopen.tst", "rb");
ok( file != NULL, "fopen failed\n");
/* sizeof(buffer) > content of file */
ok(fread(buffer, sizeof(buffer), 1, file) == 0, "fread test failed\n");
/* feof should be set now */
ok(feof(file), "feof after fread failed\n");
rewind(file);
ok(!feof(file), "feof after rewind failed\n");
fclose(file);
file = fopen("fdopen.tst", "rb");
ok( file != NULL, "fopen failed\n");
/* sizeof(buffer) > content of file */
ok(fread(buffer, sizeof(buffer), 1, file) == 0, "fread test failed\n");
/* feof should be set now */
ok(feof(file), "feof after fread failed\n");
fseek(file, 0, SEEK_SET);
ok(!feof(file), "feof after fseek failed\n");
fclose(file);
file = fopen("fdopen.tst", "rb");
ok( file != NULL, "fopen failed\n");
/* sizeof(buffer) > content of file */
ok(fread(buffer, sizeof(buffer), 1, file) == 0, "fread test failed\n");
/* feof should be set now */
ok(feof(file), "feof after fread failed\n");
fgetpos(file, &pos);
fsetpos(file, &pos);
ok(!feof(file), "feof after fsetpos failed\n");
fclose(file);
file = fopen("fdopen.tst", "rb");
ok( file != NULL, "fopen failed\n");
/* sizeof(buffer) > content of file */
ok(fread(buffer, sizeof(buffer), 1, file) == 0, "fread test failed\n");
/* feof should be set now */
ok(feof(file), "feof after fread failed\n");
fsetpos(file, &pos);
ok(!feof(file), "feof after fsetpos failed\n");
fclose(file);
unlink ("fdopen.tst");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment