public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug stdio/17647] New: ftell after ftruncate reports incorrect offset
@ 2014-11-25 15:43 siddhesh at redhat dot com
  2014-12-04  3:33 ` [Bug stdio/17647] " cvs-commit at gcc dot gnu.org
  2014-12-04  4:05 ` siddhesh at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: siddhesh at redhat dot com @ 2014-11-25 15:43 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17647

            Bug ID: 17647
           Summary: ftell after ftruncate reports incorrect offset
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: stdio
          Assignee: siddhesh at redhat dot com
          Reporter: siddhesh at redhat dot com

Currently we seek to end of file if there are unflushed writes or the
stream is in write mode, to get the current offset for writing in
append mode, which is the end of file.  The latter case (i.e. stream
is in write mode, but no unflushed writes) is unnecessary since it
will only happen when the stream has just been flushed, in which case
the recorded offset ought to be reliable.

Removing that case lets ftell give the correct offset when it follows
an ftruncate.  The latter truncates the file, but does not change the
file position, due to which it is permissible to call ftell without an
intervening fseek call.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-04  4:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-25 15:43 [Bug stdio/17647] New: ftell after ftruncate reports incorrect offset siddhesh at redhat dot com
2014-12-04  3:33 ` [Bug stdio/17647] " cvs-commit at gcc dot gnu.org
2014-12-04  4:05 ` siddhesh at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).