From: dannysmith Date: Thu, 25 Aug 2005 02:04:58 +0000 (+0000) Subject: * mingwex/stdio/fseeko64.c (fseeko64): Flush stream before X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=37209bdc840bcdee537fc608ef69694a9e673b3d;p=pf3gnuchains%2Fpf3gnuchains3x.git * mingwex/stdio/fseeko64.c (fseeko64): Flush stream before getting filelength for SEEK_END. --- diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 4566d7e010..61b73dd268 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,8 @@ +2005-08-25 Danny Smith + + * mingwex/stdio/fseeko64.c (fseeko64): Flush stream before + getting filelength for SEEK_END. + 2005-08-13 Chris Sutcliffe * Include/_mingw.h: Increment version to 3.8. diff --git a/winsup/mingw/mingwex/stdio/fseeko64.c b/winsup/mingw/mingwex/stdio/fseeko64.c index 94e17e9291..d8dcc0c44c 100755 --- a/winsup/mingw/mingwex/stdio/fseeko64.c +++ b/winsup/mingw/mingwex/stdio/fseeko64.c @@ -14,7 +14,11 @@ fseeko64 (FILE* stream, off64_t offset, int whence) pos += (fpos_t) offset; } else if (whence == SEEK_END) - pos = (fpos_t) (_filelengthi64 (_fileno (stream)) + offset); + { + /* If writing, we need to flush before getting file length. */ + fflush (stream); + pos = (fpos_t) (_filelengthi64 (_fileno (stream)) + offset); + } else if (whence == SEEK_SET) pos = (fpos_t) offset; else @@ -24,4 +28,3 @@ fseeko64 (FILE* stream, off64_t offset, int whence) } return fsetpos (stream, &pos); } -