stat(), lstat() again.
    Steve Dyer 
    dyer at spdcc.COM
       
    Sat Sep 15 06:27:13 AEST 1990
    
    
  
In article <3422 at dftsrv.gsfc.nasa.gov> jim at 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 at ursa-major.spdcc.com aka {ima,harvard,rayssd,linus,m2c}!spdcc!dyer
dyer at arktouros.mit.edu, dyer at hstbme.mit.edu
    
    
More information about the Comp.unix.aux
mailing list