This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug stdio/16724] offset computation in ftell is incorrect when a read is followed by a write for files opened in a+ mode
- From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 27 May 2014 08:25:27 +0000
- Subject: [Bug stdio/16724] offset computation in ftell is incorrect when a read is followed by a write for files opened in a+ mode
- Auto-submitted: auto-generated
- References: <bug-16724-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=16724
--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 2482ae433a4249495859343ae1fba408300f2c2e (commit)
from bab900166e8b5f0f4081c5cf1afa0cd33b123714 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2482ae433a4249495859343ae1fba408300f2c2e
commit 2482ae433a4249495859343ae1fba408300f2c2e
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Tue May 27 13:54:19 2014 +0530
Fix offset computation for append+ mode on switching from read (BZ #16724)
The offset computation in write mode uses the fact that _IO_read_end
is kept in sync with the external file offset. This however is not
true when O_APPEND is in effect since switching to write mode ought to
send the external file offset to the end of file without making the
necessary adjustment to _IO_read_end.
Hence in append mode, offset computation when writing should only
consider the effect of unflushed writes, i.e. from _IO_write_base to
_IO_write_ptr.
The wiki has a detailed document that describes the rationale for
offsets returned by ftell in various conditions:
https://sourceware.org/glibc/wiki/File%20offsets%20in%20a%20stdio%20stream%20and%20ftell
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 9 +++
NEWS | 10 ++--
libio/Makefile | 4 +-
libio/fileops.c | 12 +++-
libio/tst-ftell-append.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++
libio/wfileops.c | 13 +++-
6 files changed, 207 insertions(+), 10 deletions(-)
create mode 100644 libio/tst-ftell-append.c
--
You are receiving this mail because:
You are on the CC list for the bug.