In article <20100930134213.ga18...@colwyn.zhadum.org.uk>, Matthias Scheler <t...@netbsd.org> wrote: >On Thu, Sep 30, 2010 at 03:35:41PM +0200, Nicolas Joly wrote: >> That may be part of the problem (at least for zsh 4.2). >> >> http://www.opengroup.org/onlinepubs/009695399/functions/putenv.html >> >> >From the OpenGroup function description; this function does not copy >> the provided string, but use it directly instead. It's the caller >> responsability to clean it when not in use anymore. > >I see. > >> zsh 4.2 seems to follow this and try to deallocate the previous >> variable string when it has been replaced by a new one. But our >> putenv, which calls setenv, has already done the same ... > >So it assumes that it gets back from getenv(3) exactly what it passed >into putenv(3). Well, it seesm our putenv(3) needs a rewrite. >I think that setenv(3) and unsetenv(3) are correct as they are.
Well, if you fix putenv, please move the saveenv realloc environ code in __allocenv() so it is not in two places... christos