public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fche at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug stdio/17080] New: setvbuf _IOFBF with buf=null doesn't honor size
Date: Mon, 23 Jun 2014 13:36:00 -0000	[thread overview]
Message-ID: <bug-17080-131@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 17080
           Summary: setvbuf _IOFBF with buf=null doesn't honor size
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: minor
          Priority: P2
         Component: stdio
          Assignee: unassigned at sourceware dot org
          Reporter: fche at redhat dot com
                CC: allachan at au1 dot ibm.com, bugdal at aerifal dot cx,
                    fche at redhat dot com, glibc-bugs at sourceware dot org,
                    neleai at seznam dot cz, P at draigBrady dot com
        Depends on: 10108
              Host: i686-pc-linux-gnu
            Target: i686-pc-linux-gnu
             Build: i686-pc-linux-gnu

+++ This bug was initially created as a clone of Bug #10108 +++

Calling

   setvbuf (fp, NULL, _IOFBF, size);

results in a size-ignoring buffer, due to this block in
libio/iosetvbuf.c:

  switch (mode)
    {
    case _IOFBF:
      fp->_IO_file_flags &= ~(_IO_LINE_BUF|_IO_UNBUFFERED);
      if (buf == NULL)
        {
          if (fp->_IO_buf_base == NULL)
              if (_IO_DOALLOCATE (fp) < 0)
                {
                  result = EOF;
                  goto unlock_return;
                }
              fp->_IO_file_flags &= ~_IO_LINE_BUF;
            }
          result = 0;
          goto unlock_return;
        }
      break;

Note specifically how _IO_DOALLOCATE (fp) is called,
without any reference for the incoming size value.
(_IO_DOALLOCATE uses the block size of the underlying
filesystem.)

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


             reply	other threads:[~2014-06-23 13:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-23 13:36 fche at redhat dot com [this message]
2014-06-23 15:27 ` [Bug stdio/17080] " schwab@linux-m68k.org
2014-06-24  8:26 ` fweimer at redhat dot com
2023-06-26  6:03 ` gabravier at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-17080-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).