diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2005-08-25 02:04:59 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@users.sourceforge.net> | 2005-08-25 02:04:59 +0000 |
commit | 03ee0ba16382830c46830831553700c715b62309 (patch) | |
tree | 27859f7b36037cc0ecafb177e582e1eec72814ea /winsup | |
parent | 04dfd98dc6b216b24ff8efd98f4c0a96d15ae6d4 (diff) | |
download | cygnal-03ee0ba16382830c46830831553700c715b62309.tar.gz cygnal-03ee0ba16382830c46830831553700c715b62309.tar.bz2 cygnal-03ee0ba16382830c46830831553700c715b62309.zip |
* mingwex/stdio/fseeko64.c (fseeko64): Flush stream before
getting filelength for SEEK_END.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/mingw/ChangeLog | 5 | ||||
-rwxr-xr-x | winsup/mingw/mingwex/stdio/fseeko64.c | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 4566d7e01..61b73dd26 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -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> * 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 94e17e929..d8dcc0c44 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); } - |