strcat/access question

Conor P. Cahill cpcahil at virtech.UUCP
Wed Oct 4 11:00:22 AEST 1989


In article <9733 at chinet.chi.il.us>, john at chinet.chi.il.us (John Mundt) writes:
> 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.  
> 
> 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().

The part about stepping on other environment variables is true, but the cause
of the problem is not that access() requires something in the environment.
access(2) is a system call and system calls don't use any such thing as an
environment variable (can you imagine the kernel searching through your
data space looking for some strings?)

The problem is that the original poster appended the path from his HOME 
directory to the file twice thereby generating a non-existent file name.



-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+



More information about the Comp.lang.c mailing list