public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/13151] New: fmemopen streams fail to read eof
@ 2011-09-05  2:24 bugdal at aerifal dot cx
  2012-02-21  2:30 ` [Bug stdio/13151] " jsm28 at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: bugdal at aerifal dot cx @ 2011-09-05  2:24 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=13151

             Bug #: 13151
           Summary: fmemopen streams fail to read eof
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: bugdal@aerifal.cx
    Classification: Unclassified


Streams obtained by fmemopen fail to yield EOF when attempting to read past the
"current size" of the buffer. Minimal failure case:

FILE *f = fmemopen((char[10]){"hello"}, 10, "a+");
assert(getc(f)==EOF);

(The "current size" established by opening in append mode is the offset of the
null byte, 5.)

Reference:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html

I understand that the GNU fmemopen predated the standardized function, and I'm
not sure what politics were involved in writing the standard such that the
existing GNU version did not conform. Nonetheless, this should be fixed. If you
want to keep the original GNU behavior, there should be a separate
__posix_fmemopen that gets used when _POSIX_C_SOURCE >= 200809L.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2015-07-08 15:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-05  2:24 [Bug libc/13151] New: fmemopen streams fail to read eof bugdal at aerifal dot cx
2012-02-21  2:30 ` [Bug stdio/13151] " jsm28 at gcc dot gnu.org
2012-04-27 20:16 ` mtk.manpages at gmail dot com
2012-04-27 20:31 ` mtk.manpages at gmail dot com
2012-04-28  2:21 ` mtk.manpages at gmail dot com
2012-04-28  3:28 ` mtk.manpages at gmail dot com
2012-04-28  4:26 ` mtk.manpages at gmail dot com
2012-12-19 10:39 ` schwab@linux-m68k.org
2013-05-20 15:24 ` ondra at iuuk dot mff.cuni.cz
2014-02-16 18:29 ` jackie.rosen at hushmail dot com
2014-05-28 19:40 ` schwab at sourceware dot org
2014-06-27 12:10 ` fweimer at redhat dot com
2015-07-08 15:16 ` adhemerval.zanella at linaro dot org

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).