int
access(
const char *path
, int mode
)
)
function checks the accessibility of the
file named by
path
for the access permissions indicated by
mode
.
The value of
mode
is the bitwise inclusive OR of the access permissions to be
checked
(
R_OK
for read permission,
W_OK
for write permission and
X_OK
for execute/search permission) or the existence test,
F_OK
.
All components of the pathname
path
are checked for access permissions (including
F_OK
).
The real user ID is used in place of the effective user ID and the real group access list (including the real group ID) are used in place of the effective ID for verifying permission.
If a process has super-user privileges and indicates success for
R_OK
or
W_OK
,
the file may not actually have read or write permission bits set.
If a process has super-user privileges and indicates success for
X_OK
,
at least one of the user, group, or other execute bits is set.
(However, the file may still not be executable.
See
execve(2).)
path
cannot be found or if any of the desired access modes would
not be granted, then a -1 value is returned; otherwise
a 0 value is returned.
ENOTDIR
]
ENAMETOOLONG
]
{NAME_MAX}
characters, or an entire path name exceeded
{PATH_MAX}
characters.
ENOENT
]
ELOOP
]
EROFS
]
ETXTBSY
]
EACCES
]
EFAULT
]
path
points outside the process's allocated address space.
EIO
]
)
function conforms to
ISO/IEC 9945-1:1990 (``POSIX.1'') .
)
is a potential security hole and
should never be used.