Using environment variables without leaking memory?

Rich Felker dalias at aerifal.cx
Thu Oct 26 07:59:46 UTC 2006


On Tue, Oct 24, 2006 at 03:51:35PM -0400, Rob Landley wrote:
> Not actually all that hard to implement, really.  Why people have accepted 
> such a screwed up status-quo for 15 years (forget about Unix, why have the 
> _linux_ people accepted it?) is an open question.

I suspect the reason is a very good one: modifying the environment is
something you have to do only very rarely (i.e. only a small number of
programs do it, even if those few do it often), and any "fix" would
not be available on other systems, so writing programs dependent on
the fix would just mean more non-portable programs. Instead it's more
practical just to write a solution that works everywhere, like
deferring modification of the environment until after you fork.

Of course no one's going to stop you from writing your own functions
for managing the environment via the "environ" var... :) That should
work everywhere too.

Rich



More information about the uClibc mailing list