Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Buffered stderr on Linux
- X-seq: zsh-workers 814
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxx>
- To: schaefer@xxxxxxx
- Subject: Re: Buffered stderr on Linux
- Date: Tue, 12 Mar 1996 21:26:05 +0100 (MET)
- Cc: zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: <9603121124.ZM2604@xxxxxxxxxxxxxxxxxxxxxxx> from Bart Schaefer at "Mar 12, 96 11:24:25 am"
- Organization: Dept. of Comp. Sci., Eotvos University, Budapest, Hungary
- Phone: (36 1)2669833 ext: 2667, home phone: (36 1) 2752368
Bart Schaefer wrote:
> On Mar 12, 8:03pm, Zoltan Hidvegi wrote:
> } Subject: Buffered stderr on Linux
> }
> } Now I wander why is it
> } necessary to use malloc to allocate these buffers. Is there anything
> } against using static char[BUFSIZ] buffers?
>
> Stdio will call free() on the buffer at fclose(). That means you should
> always pass malloc'd buffers, and never call free() yourself on a buffer
> that's been passed to any of the setbuf() variants!
As far as I know zsh never closes stdout and stderr explicitely. Of course
there is an implicit close on exit() (but not on _exit() which zsh use when
it forked) and a free may fail here but it is probably harmless. Anyway it
is probably better to stay clean and use malloc.
Zoltan
Messages sorted by:
Reverse Date,
Date,
Thread,
Author