[braindamaged?] use of access(2)

Stephen J. Friedl friedl at vsi.UUCP
Sat Apr 9 13:26:28 AEST 1988


In article <7591 at ncoast.UUCP>, allbery at ncoast.UUCP (Brandon Allbery) writes:
< As quoted from <368 at wsccs.UUCP> by terry at wsccs.UUCP (terry):
< | I write:
< | > The difficulty is because the shell probably uses access(2) to see if
< | > /usr/acct/bin/report is executable
< | 
< | It does.  Isn't that what it's supposed to do?
< 
< sh uses access()?  Since the real and effective u/gids are not
< affected by an exec(), access() is the *wrong* function to use.

SVR2 and SVR3 shells do indeed use access(2) incorrectly. MORAL:
If you just want to know if a file exists, please use stat(),
not access(2).
-- 
Steve Friedl   V-Systems, Inc.   "Yes, I'm jeff at unh's brother"
friedl at vsi.com  {backbones}!vsi.com!friedl  attmail!vsi!friedl



More information about the Comp.lang.c mailing list