Xref: utzoo comp.unix.microport:2866 comp.unix.wizards:14797 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pacbell!sactoh0!tree!asmodeus From: asmodeus@tree.UUCP (Jonathan Ballard) Newsgroups: comp.unix.microport,comp.unix.wizards Subject: Re: bug in putenv()! Keywords: bug putenv Message-ID: <232@tree.UUCP> Date: 20 Feb 89 18:45:51 GMT References: <204@tree.UUCP> <12649@jade.BBN.COM> Organization: TREE BBS (916)-349-0385 Sacramento, Ca Lines: 26 In article <12649@jade.BBN.COM>, mlandau@bbn.com (Matt Landau) writes: > In comp.unix.wizards, asmodeus@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