strcat/access question

John Mundt john at chinet.chi.il.us
Wed Oct 4 00:10:42 AEST 1989


In article <5409 at umd5.umd.edu> jjk at astro.UMD.EDU writes:
>Here is a section of code:
>
>if((home=getenv("HOME"))==(char *) 0)
>printf("%d:\n", access(strcat(home, "/astro/data/obs.list"), 4));

home is a char pointer, pointing to somewhere in the environmental
variable area that was passed to main since that is where getenv()
looks for things like HOME.  

	main(int argc, char **argv, char **env)


When you concatenated home with the rest of the path, it would have
to step on other environmental variables, probably one that was
needed by access().
-- 
---------------------
John Mundt   Teachers' Aide, Inc.  P.O. Box 1666  Highland Park, IL
john at chinet.chi.il.us
(312) 998-5007 (Day voice) || -432-8860 (Answer Mach) && -432-5386 Modem  



More information about the Comp.lang.c mailing list