bug in putenv()!

Jonathan Ballard asmodeus at tree.UUCP
Tue Feb 21 04:45:51 AEST 1989


In article <12649 at jade.BBN.COM>, mlandau at bbn.com (Matt Landau) writes:
>  In comp.unix.wizards, asmodeus at tree.UUCP (Jonathan Ballard) writes:
[stuff deleted]
> putenv and expect anything reasonable to happen - you have to pass
> either global or allocated storage.
> 
> The SunOS 3.5 man page on putenv, for example, says this:
> 
>   	A potential error is to call putenv with an automatic vari-
>         able as the argument, then exit the calling function while
> 	string is still part of the environment.

Ours says the same thing.  I've tried global varible and pointers also.
They didn't work right either.
The strange part is everybody says the a automatic varible won't work.
Why is it then when I use this next example that it works fine.  Notice
it is defining the enviromental varible to a number.
	sprintf(envbuf,"UID=%d",12);
	putenv(envbuf);
It worked fine and stayed in the enviroment.

-- 
----Asmodeus - Jonathan Ballard  ..!csusac!tree!asmodeus
				 ..!pacbell!sactoh0!tree!asmodeus
"I'm going to create the best game ever heard of!
	Might take a few years thou..." -me



More information about the Comp.unix.wizards mailing list