From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27494 invoked by alias); 23 Jun 2014 13:36:38 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 27398 invoked by uid 48); 23 Jun 2014 13:36:33 -0000 From: "fche at redhat dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: stdio X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: fche at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc dependson cf_gcchost cf_gcctarget cf_gccbuild Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-06/txt/msg01386.txt.bz2 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.