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 libc/10108] New: setvbuf _IOFBF doesn't honor size correctly


The following program shows some weird behaviour on fedora 8 (glibc-2.7-2).
Basically the printf is output immediately when it should be buffered.
Note the trailing \n is not output.

The conditions that this happens is:
* The first write only.
* and the write is > 1 byte.
* and specified buffer size is < 128.

Bug 6719 seems related but different I think.

#include <stdio.h>
#include <stdlib.h>
int main(void)
{
    int size=10; //128 required on glibc-2.7 for expected operation
    char* buf=malloc(size);
    setvbuf (stdout, buf, _IOFBF, size);
    printf("too soon\n");
    sleep(2);
}

-- 
           Summary: setvbuf _IOFBF doesn't honor size correctly
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: P at draigBrady dot com
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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