Follow-up: setenv() doesn't export unsetenv()ed variables to environ

Andrey Chernov ache at nagual.pp.ru
Mon Sep 10 04:18:50 PDT 2007


On Mon, Sep 10, 2007 at 08:17:36AM +0900, YAMAMOTO, Taku wrote:
> > --- lib/libc/stdlib/getenv.c.orig	2007-07-21 08:30:13.000000000 +0900
> > +++ lib/libc/stdlib/getenv.c	2007-09-10 08:07:22.732672106 +0900
> > @@ -492,7 +492,7 @@ __setenv(const char *name, size_t nameLe
> >  	newEnvActive++;
> >  
> >  	/* No need to rebuild environ if the variable was reused. */
> > -	if (reuse)
> > +	if (reuse && newEnvActive == envActive)
> >  		return (0);
> >  	else
> >  		return (__rebuild_environ(newEnvActive));

Looks like the right fix.
CC'ed to author.

-- 
http://ache.pp.ru/


More information about the freebsd-current mailing list