Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!lll-winken!ames!dftsrv!jagmac2.gsfc.nasa.gov!jim From: jim@jagmac2.gsfc.nasa.gov (Jim Jagielski) Newsgroups: comp.unix.aux Subject: Re: stat(), lstat() again. Message-ID: <3475@dftsrv.gsfc.nasa.gov> Date: 23 Sep 90 15:25:24 GMT References: <4062@ursa-major.SPDCC.COM> <3434@dftsrv.gsfc.nasa.gov> <2842@sequent.cs.qmw.ac.uk> Sender: news@dftsrv.gsfc.nasa.gov Reply-To: jim@jagmac2.gsfc.nasa.gov (Jim Jagielski) Organization: NASA/Goddard Space Flight Center Lines: 39 In article <2842@sequent.cs.qmw.ac.uk> liam@cs.qmw.ac.uk (William Roberts) writes: >Do you now accept that > >1) the stat and lstat functions require a pointer to a statbuf structure >2) the stat and lstat functions don't do memory allocation for that structure >3) NULL is not a good choice of random address for a structure >4) You should be using &statbuf regardless of the fact that some > compiler/machine/architecture combinations let you get away with > what you were doing before. > As I wrote to Steve, yes I DID make a major mistake: 1st by passing the wrong thing to stat and lstat and secondly NOT accepting the obvious reason for the mistake... that the reason it DIDN'T work with cc and gcc is because stuff was getting crunched since the pointer either pointed somewhere unknown or to NULL (0). That is in essense what the entire thing was about... My other comments about how stuff was being changed by different compilers was really not appropriate, since even if it DID work with some other compilers, that still doesn't affect the fact that the code was plain and simple WRONG. The only thing that reall upset me was the comment concerning my knowledge of C and that's what caused my flame... a bruised ego is a dangerous thing and I am sorry for that. Everyone makes mistakes and I just didn't want a stupid one to give the impression that I don't know C (although at the time, maybe my mind was such mush that I didn't even know my name :). Anyway, I hope all this is over with. I made my peace and apologies to Steve and appreciate all his ( and everyone else's) comments and illumination. The moral is: Think before you act... I gotta start doing that MORE! -- ======================================================================= #include =:^) Jim Jagielski NASA/GSFC, Code 711.1 jim@jagmac2.gsfc.nasa.gov Greenbelt, MD 20771 "Kilimanjaro is a pretty tricky climb. Most of it's up, until you reach the very, very top, and then it tends to slope away rather sharply."