* mingwex/stdio/fseeko64.c (fseeko64): Flush stream before

getting filelength for SEEK_END.
This commit is contained in:
Danny Smith 2005-08-25 02:04:59 +00:00
parent 04dfd98dc6
commit 03ee0ba163
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2005-08-25 Danny Smith <dannysmith@users.sourceforge.net>
* mingwex/stdio/fseeko64.c (fseeko64): Flush stream before
getting filelength for SEEK_END.
2005-08-13 Chris Sutcliffe <ir0nh34d@users.sourceforge.net> 2005-08-13 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* Include/_mingw.h: Increment version to 3.8. * Include/_mingw.h: Increment version to 3.8.

View File

@ -14,7 +14,11 @@ fseeko64 (FILE* stream, off64_t offset, int whence)
pos += (fpos_t) offset; pos += (fpos_t) offset;
} }
else if (whence == SEEK_END) else if (whence == SEEK_END)
{
/* If writing, we need to flush before getting file length. */
fflush (stream);
pos = (fpos_t) (_filelengthi64 (_fileno (stream)) + offset); pos = (fpos_t) (_filelengthi64 (_fileno (stream)) + offset);
}
else if (whence == SEEK_SET) else if (whence == SEEK_SET)
pos = (fpos_t) offset; pos = (fpos_t) offset;
else else
@ -24,4 +28,3 @@ fseeko64 (FILE* stream, off64_t offset, int whence)
} }
return fsetpos (stream, &pos); return fsetpos (stream, &pos);
} }