This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug stdio/17080] New: setvbuf _IOFBF with buf=null doesn't honor size


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]