Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think.com!mintaka!spdcc!dyer From: dyer@spdcc.COM (Steve Dyer) Newsgroups: comp.unix.aux Subject: Re: stat(), lstat() again. Message-ID: <4038@ursa-major.SPDCC.COM> Date: 14 Sep 90 20:27:13 GMT References: <3422@dftsrv.gsfc.nasa.gov> Reply-To: dyer@ursa-major.spdcc.COM (Steve Dyer) Organization: S.P. Dyer Computer Consulting, Cambridge MA Lines: 20 In article <3422@dftsrv.gsfc.nasa.gov> jim@jagmac2.gsfc.nasa.gov (Jim Jagielski) writes: ]Well... if I do the following, lstat() doesn't work: ] struct stat *sbuf; ] lstat("/unix", sbuf); ]But this DOES: ] struct stat sbuf; ] lstat("/unix", &sbuf); ] ]It looks like in case #1, sbuf is pointing somewhere dangerous and when lstat ]is called, memory is destroyed... OK, so where's the bug? You've not understood the C language. Just where do you think sbuf is pointing to in the first example? If you don't assign a value to a variable, how can you expect to use its value as something meaningful? -- Steve Dyer dyer@ursa-major.spdcc.com aka {ima,harvard,rayssd,linus,m2c}!spdcc!dyer dyer@arktouros.mit.edu, dyer@hstbme.mit.edu