Writing to A NON-Existing File in "C"
Henry Spencer
henry at utzoo.uucp
Sun Apr 17 08:46:43 AEST 1988
> I'd do it slightly different. Unless you need speed, try using
> access(2) to determine if the file is available to you...
--------------------------> NO!!! <-----------------------
You should never use access(2) except when a setuid program wants to
determine whether a file would be accessible in the absence of setuid
privileges. For determining accessibility in normal circumstances,
use stat(2) and look at the mode bits. (There was an eaccess() function
posted to one of the sources groups a few years ago that would do this
for you.) If your program happens to be run under setuid conditions,
and it is using access(2) for ordinary availability checking, it will
get the wrong answers.
--
"Noalias must go. This is | Henry Spencer @ U of Toronto Zoology
non-negotiable." --DMR | {ihnp4,decvax,uunet!mnetor}!utzoo!henry
More information about the Comp.unix.questions
mailing list