setvbuf()

Peter Naulls peter at chocky.org
Fri Jan 2 02:52:57 PST 2004


In message <f5c72a6a4c.peter at chocky.org>
          Peter Naulls <peter at chocky.org> wrote:

>           Stefan Bellon <sbellon at sbellon.de> wrote:
>
> > I just noticed that the following call
> > 
> >     setvbuf(stdout, NULL, _IOLBF, 0);
> > 
> > I think, I once again mentioned that I had problems with malloc(0).
> > Inside do_buffer() in stdio/setbuf.c there's a malloc() call with the
> > size argument. So, this would be a malloc(0). I really suspect there's
> > some problem with that.
> 
> You reasoning could well be correct.  I'll try and take a look at this
> soon.

Having read this again, I don't entirely agree. As has been stated
before, malloc(0) is perfectly valid, and what you're seeing is really
simply a side effect of heap corruption elsewhere.

However, I'm unable to repeat this with a simple program; to look
further into this, I need a minimal test case from you.

-- 
Peter Naulls - peter at chocky.org        | http://www.chocky.org/
----------------------------------------------------------------------------
AcornSearch - http://www.drobe.co.uk/  | Relevant RISC OS searches




More information about the gcc mailing list